macos – Command not found go — on Mac after installing Go

macos – Command not found go — on Mac after installing Go

Like bjhaid mentioned in the comments above:

This is happening because you must add your PATH to your ~/.zshrc file.

in the ~/.zshrc you should add the line:

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

you should then source you .zshrc file:

. ~/.zshrc

I kept running into issues and followed the steps on here and finally got a working solution: http://totzyuta.github.io/blog/2015/06/21/installing-go-by-homebrew-on-mac-os-x/

Install w/brew:

brew install golang

Edit bash_profile and add following paths:

nano ~/.bash_profile

export GOROOT=/usr/local/opt/go/libexec
export GOPATH=$HOME/.go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Source it:

source ~/.bash_profile

Then restart terminal

go version

Output: go version go1.12 darwin/amd64

macos – Command not found go — on Mac after installing Go

For bash, you should edit the .bashrc file and add the abobe mentioned line:

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

Leave a Reply

Your email address will not be published.