Home  >  Article  >  Backend Development  >  Why is "go install" not working with zsh on macOS?

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

Linda Hamilton
Linda HamiltonOriginal
2024-11-07 20:38:03846browse

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.

The above is the detailed content of Why is "go install" not working with zsh on macOS?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn