Martin Flower
Martin Flower

Reputation: 371

go install - do I need to manually update my path?

I'm a bit confused on what the latest best practice is with Go.

Installing the latest (1.17) Go on macos, with no GOPATH env variable, with go mod, I see the following is in my path

/usr/local/go/bin

When I run go install <something>, then that ends up in ~/go/bin/<something>. So why is ~/go/bin not in my path? Do I have to add it manually?

Upvotes: 7

Views: 7811

Answers (1)

aureliar
aureliar

Reputation: 1584

Yes you have to manually add ~/go/bin to your PATH.

To do so, add this line in your shell init file (.bashrc, .zshrc ...):

export PATH=$PATH:$HOME/go/bin

Upvotes: 10

Related Questions