This quick tutorial is going to cover about where does Vagrant store its boxes after downloading.
1. Where does Vagrant store its boxes?
By default, Vagrant stores its boxes after downloading in the directory defined by VAGRANT_HOME environment variable. As a result,
- On Mac OS X and Linux: ~/.vagrant.d/boxes
- On Windows: C:/Users/USERNAME/.vagrant.d/boxes
2. Change the directory where Vagrant stores its boxes?
There are some situations that we may want to change the directory where Vagrant stores its boxes to other directories such as to backup the boxes, to reduce disk space on the main partition, etc. In such a case, we can change the VAGRANT_HOME variable to our desired location.
Here is an example how we can change the VAGRANT_HOME environment to another location on Unix-like systems:
On Windows, we can use the “setx” command, for example:
setx VAGRANT_HOME "D:\data\vagrant"
Or you can:
- Open Control Panel –> System –> Advanced System Settings –> Advanced –> Environment Variables –> New
- Enter Variable Name is VAGRANT_HOME
- And enter the Variable Value is your desired location, for example:
The tutorial has show us the location where does Vagrant store its boxes. We can see that Vagrant stores its box in the location specified by the VAGRANT_HOME environment variable. As a result, we can change that location to another one by simply changing the environment variable.
Below are other related articles for your references: