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 email@example.com Updating Homebrew... ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask). ==> Updated Formulae firstname.lastname@example.org ✔ ==> Downloading https://email@example.com Already downloaded: /Users/username/Library/Caches/Homebrewfirstname.lastname@example.org ==> Pouring email@example.com ==> Caveats firstname.lastname@example.org 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 email@example.com first in your PATH run: echo 'export PATH="/firstname.lastname@example.org/bin:$PATH"' >> ~/.zshrc ==> Summary 🍺 /usr/local/Cellaremail@example.com/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 (
firstname.lastname@example.org) 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 email@example.com Linking /usr/local/Cellarfirstname.lastname@example.org/1.12.9... 3 symlinks created If you need to have this software first in your PATH instead consider running: echo 'export PATH="/email@example.com/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