Install Vagrant from source
Vagrant installations from source is an advanced operation. We only recommended if you cannot use the official installer. This page details the prerequisites and three steps to install Vagrant from source.
- Install Ruby
- Clone Vagrant
- Configure locally
To develop and build Vagrant, you must install a specific version of Ruby. The
specific Ruby version that you will need is documented
vagrant.gemspec, located in the repository on GitHub.
It contains the most up-to-date requirements.
You will also need to be aware of plugin compatibility between Vagrant source installations and package based installations. Since Vagrant plugins are configured based on the current environment, plugins installed with Vagrant from source will not work with the package based Vagrant installation.
Clone Vagrant's repository from GitHub into the directory where you keep code on your machine.
$ git clone https://github.com/hashicorp/vagrant.git
cd into that path. You must initiate all commands from this directory.
$ cd /path/to/your/vagrant/clone
bundle command with a required version* to install the requirements.
$ bundle install
You can now start Vagrant with the
$ bundle exec vagrant
In order to use your locally-installed version of Vagrant in other projects, you will need to create a binstub and add it to your path.
First, use the
bundle command from your Vagrant directory.
$ bundle --binstubs exec
This will generate files in
vagrant. You can now specify
the full path to the
exec/vagrant anywhere on your operating system.
$ /path/to/vagrant/exec/vagrant init -m hashicorp/bionic64
Tip: Warning messages are expected when you use a local Vagrant from source installation, since it is not supported or recommended.
If you do not want to specify the full path to Vagrant (i.e. you just want to
vagrant), you can create a symbolic link to your exec.
$ ln -sf /path/to/vagrant/exec/vagrant /usr/local/bin/vagrant
When you want to switch back to the official Vagrant version, remove the symlink.