Downgrading Vagrant with Brew


Update Jan 16, 2017 This issue has been addressed in vagrant-installers with commit e1867522. It’s not always a good idea to downgrade a software, so do make sure you know what you are doing.

I was trying to provision the spark-in-action VM with Vagrant. When I issued the vagrant box add command to download the VM, I got the following error message:

$ vagrant box add spark-in-action-box.json
==> box: Loading metadata for box 'spark-in-action-box.json'
    box: URL: file:///Users/eugeneteo/path/to/first-edition/spark-in-action-box.json
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

If you look at this bug report, it looks like there is an issue with the version of libcurl.4.dylib in Vagrant 1.8.7:

$ /opt/vagrant/embedded/bin/curl -V
dyld: Library not loaded: @rpath/libcurl.4.dylib
  Referenced from: /opt/vagrant/embedded/bin/curl
  Reason: Incompatible library version: curl requires version 9.0.0 or later, but libcurl.4.dylib provides version 7.0.0
Trace/BPT trap: 5

Fortunately, it is easy to workaround this problem.

First, run brew cask remove to uninstall Vagrant. Next, look through Vagrant’s Cask file commits, find the version of Vagrant you want to downgrade from, and run brew cask install.

$ brew cask install https://raw.githubusercontent.com/caskroom/homebrew-cask/60531a2812005dd5f17dc92f3ce7419af3c5d019/Casks/vagrant.rb
==> Downloading https://raw.githubusercontent.com/caskroom/homebrew-cask/60531a2812005dd5f17dc92f3ce
######################################################################## 100.0%
==> Downloading https://releases.hashicorp.com/vagrant/1.8.6/vagrant_1.8.6.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask vagrant
==> Running installer for vagrant; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
==> installer: Package name is Vagrant
==> installer: Installing at base path /
==> installer: The install was successful.
🍺  vagrant was successfully installed!

Issuing the vagrant box add command should work now!

$ vagrant box add spark-in-action-box.json
==> box: Loading metadata for box 'spark-in-action-box.json'
    box: URL: file:///Users/eugeneteo/path/to/first-edition/spark-in-action-box.json
==> box: Adding box 'manning/spark-in-action' (v1.0.0) for provider: virtualbox
    box: Downloading: https://s3-us-west-2.amazonaws.com/manning-code/spark-in-action.box
[...]

Hopefully, this issue gets resolved soon, and I will upgrade Vagrant back to the current version.