Troubleshooting Go Installation Issues in zsh
Facing difficulties with installing Go using zsh? Let's troubleshoot your setup and identify the missing pieces.
You have created a workspace directory (~/go) and added the following line to your ~/.bash_profile and ~/.zshrc files:
export PATH=$PATH:/usr/local/go/bin
Despite these additions, when you run "go env" from your home directory, you receive the error "zsh: command not found: go." This suggests that your configuration is incorrect.
If you installed Go on macOS using the package installer rather than Homebrew, your GOBIN will reside in /usr/local/go and GOPATH in $HOME/go. To rectify this, adjust your ~/.zshrc file as follows:
export GOPATH=$HOME/go export GOROOT=/usr/local/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOPATH export PATH=$PATH:$GOROOT/bin
By making these changes, you ensure that the correct directories are included in your PATH environment variable, allowing you to execute Go commands from any directory.
The above is the detailed content of Why Can't I Find the 'go' Command After Installing Go in zsh?. For more information, please follow other related articles on the PHP Chinese website!