I have go versions 1.13.1 and 1.12.9 installed
$brew list --versions | grep go
go 1.13.1
[email protected] 1.12.9
But I am unable to switch to 1.12, an error indicates that I only have version 1.13.1 installed contradicting the earlier listing.
$brew switch go 1.12
Error: go does not have a version "1.12" in the Cellar.
go installed versions: 1.13.1
And when I look carefully at go versions (no grep)
$brew list --versions go
go 1.13.1
So I must have done something wrong when I installed go 1.12, but what? I used brew install [email protected]
, should I have used another syntax?
How to Work With Multiple Go Versions. We can use the go install command to download install individual versions of Go. Running go install golang.org/dl/go<version>@latest will download and install a wrapper Go command for the specific Go version.
Installing an older version you never had installed before Since Homebrew doesn't provide a command to arbitrarily select a version to install, you have to manually find the version you need in Homebrew's GitHub repository, copy the URL to it and pass it as an argument for manual installation.
go
and [email protected]
are installed as two packages with different names, which means they are installed at different locations. /usr/local/Cellar/go
and /usr/local/Cellar/[email protected]
.
In this situation, you should use brew link
.
brew unlink go
brew link [email protected] --overwrite
More explanation about brew switch
. brew switch <version>
is used to switch version installed with the same package name.
For example, If both go
1.13 and 1.13.1 installed, they're put in
/usr/local/Cellar/go/1.13
/usr/local/Cellar/go/1.13.1
In this situation, use brew switch
.
brew switch go 1.13
brew switch go 1.13.1
brew switch
has been dropped since Homebrew 2.6.0.
Anyone still want the old brew switch
, use the following tap, where brew switch
is included as a custom sub-command.
brew tap laggardkernel/tap
brew switch --help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With