Downgrade Go installed with HomebrewPublished on September 13, 2019
I just had the issue that I installed Go 1.13 which messed up VSCode auto completion and is also not supported by the CI pipeline I wanted to use. This meant I needed to downgrade to Go 1.12.9.
This took me a bit longer than I’d be willing to admit. Partially because the naming in Homebrew is sometimes a bit hard to follow #11091.
There are 3 simple steps involved: Install wanted version, unlink old one, link new one.
Check current version
~|⇒ go version go version go1.13 darwin/amd64
Install specific version you want
The available versions are listed in the Hombrew directory. The Example for Go would be here.
~|⇒ brew install firstname.lastname@example.org Updating Homebrew... ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask). ==> Updated Formulae email@example.com ✔ ==> Downloading https://firstname.lastname@example.org Already downloaded: /Users/username/Library/Caches/Homebrewemail@example.com ==> Pouring firstname.lastname@example.org ==> Caveats email@example.com is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have firstname.lastname@example.org first in your PATH run: echo 'export PATH="/email@example.com/bin:$PATH"' >> ~/.zshrc ==> Summary 🍺 /usr/local/Cellarfirstname.lastname@example.org/1.12.9: 9,819 files, 452.8MB
Unlink currently installed version
~|⇒ brew unlink go Unlinking /usr/local/Cellar/go/1.13... 3 symlinks removed
Force link the specific version
As the specific formula we want (
email@example.com) is a keg-only formula it must be linked with
--force. If you try without it’ll tell you just that. As explained in the FAQ a key-only formula is one that’s only installed into our
/usr/local/Cellar directory without being linked automatically.
~|⇒ brew link --force firstname.lastname@example.org Linking /usr/local/Cellaremail@example.com/1.12.9... 3 symlinks created If you need to have this software first in your PATH instead consider running: echo 'export PATH="/firstname.lastname@example.org/bin:$PATH"' >> ~/.zshrc
Now that everything is linked correctly it should show the specific version we want:
~|⇒ go version go version go1.12.9 darwin/amd64