Roots Discourse

Downgrading Vagrant version

I ended up coming across this Composer could not find a composer.json file on ‘vagrant up’ issue and wanted to share at least a way to downgrade vagrant. Sharing here since that thread is closed.

I followed these stack overflow instructions. I think the other solution on the same thread might make even more sense, but if you are going for version 2.2.10, the below code added to a file named with an .rb extension and running brew install --cask the_file.rb should do the trick (once you have run brew remove vagrant.)

It’s basically just updating the git commit and sha256 numbers that the url the little script pulls from references.

cask "vagrant" do
  version "2.2.10"
  sha256 "913d959455d37a0bb410c89ba3aedc886ccc76ce06bae7b228ba7454294325da"

  url "https://releases.hashicorp.com/vagrant/#{version}/vagrant_#{version}_x86_64.dmg",
      verified: "hashicorp.com/vagrant/"
  name "Vagrant"
  desc "Development environment"
  homepage "https://www.vagrantup.com/"

  livecheck do
    url "https://github.com/hashicorp/vagrant"
    strategy :git
  end

  pkg "vagrant.pkg"

  uninstall script:  {
    executable: "uninstall.tool",
    input:      ["Yes"],
    sudo:       true,
  },
            pkgutil: "com.vagrant.vagrant"

  zap trash: "~/.vagrant.d"
end

1 Like