Bash can't find go exectuable after installing Go package for OS X

11

2

I installed Go (programming language) to Max OS X but "go version" in terminal gives

-bash: go: command not found

Echoing $PATH returns:

/Users/user/.rvm/gems/ruby-1.9.3-p194/bin:/Users/user/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/user/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/sbin

What do I need to change to start using Go?

barcodesIllIIIlIl

Posted 2012-09-09T17:14:10.187

Reputation: 123

1How did you install it? – Ignacio Vazquez-Abrams – 2012-09-09T17:18:11.990

The installer linked here: http://www.golang-book.com/

– barcodesIllIIIlIl – 2012-09-09T17:55:47.170

Answers

22

Go should be installed to either /usr/local/go/bin or ~/Go/bin — I can't test the installer now.

Try editing your ~/.bash_profile by calling:

nano ~/.bash_profile

Then adding:

export PATH=$PATH:/usr/local/go/bin

Save the file by pressing CtrlO, then , and reload your shell (e.g. by restarting the Terminal). Now, go should work as a command, assuming it is provided as /usr/local/go/bin/go.

slhck

Posted 2012-09-09T17:14:10.187

Reputation: 182 472

I cannot find /usr/local/go. What if I used GVM? – IgorGanapolsky – 2016-09-12T00:58:20.393

1

GVM should install into ~/.gvm, but I have never used it. If even the gvm command is not working for you, perhaps it's better to raise an issue here: https://github.com/moovweb/gvm — or look at the documentation. Maybe something went wrong during the installation.

– slhck – 2016-09-13T09:11:14.590