"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Why is "go install" not working with zsh on macOS?

Why is "go install" not working with zsh on macOS?

Published on 2024-11-19
Browse:494

Why is

Troubleshooting "Go install not working with zsh" in macOS

When encountering issues with the "go install" command in zsh, it's essential to verify your configuration settings. If you've added the "export PATH" line to both ~/.bash_profile and ~/.zshrc, but still face difficulties, there could be additional configuration required.

The provided configuration suggests that you installed Go using the macOS package installer rather than Homebrew. In this case, the GOBIN variable should be set to "/usr/local/go" and GOPATH to "$HOME/go". To address this, update your ~/.zshrc file with the following lines:

export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH
export PATH=$PATH:$GOROOT/bin

These settings correctly configure GOBIN and GOPATH for the macOS package installer's installation location. After updating your configuration, close and reopen your terminal to ensure the changes are loaded. You should now be able to successfully run "go install" using zsh.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3