Reputation: 2723
I followed the link to download Go 1.2.1 and tried to install in Mavericks OSX. After installing with the binary package, I cd into the path /usr/local/go and found all the executables. However when I try to run
go version
it returns
$ command not found: go
I am not sure what I did wrong but I can't find any resource to it. I also tried to follow this tutorial (link) but still failed. Any help?
Upvotes: 2
Views: 3018
Reputation:
On a Mac, after downloading the archive and running it, Go is by default installed at /usr/local/go
. The next thing you do is to simply have export PATH=$PATH:/usr/local/go/bin
in your .profile
. If run into something like $ command not found: go
, just restart your terminal.
As far as I'm concerned the only mention of
export GOROOT=$HOME/go1.X
export PATH=$PATH:$GOROOT/bin
is when you're installing a different location other than /usr/local/go
according to the official installation instructions.
Upvotes: 0
Reputation: 222969
By default go is installed in /usr/local/go/bin
. So I fixed the issue by adding this line in bash_profile:
nano ~/.bash_profile
)export PATH=$PATH:/usr/local/go/bin
and it should work:
$ go version
go version go1.4.2 darwin/amd64
Upvotes: 6
Reputation: 6555
If the binaries exist then the directory must not be in your $PATH variable. Per the tutorial you linked, make sure that the following two lines are in your shell profile:
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
Upvotes: 10