Home >Backend Development >Golang >Why Doesn't My Mac Terminal Recognize the 'go' Command After Go Installation?
Addressing "Command Not Found Go" Error in MacOS Terminal After Go Installation
Despite installing Go software, attempts to execute the "go version" command yield the "command not found" error. This issue arises when the installation path is not properly added to the system configuration.
To resolve the problem:
Add Path to ~/.zshrc File:
Unlike the bash profile, the user must update the ~/.zshrc file for changes to take effect in the zsh terminal. Within this file, add the following lines:
export PATH=$PATH:/usr/local/go/bin export PATH=$PATH:$GOPATH/bin
Source ~/.zshrc File:
After modifying the ~/.zshrc file, execute the following command to refresh the terminal configuration:
. ~/.zshrc
Once these steps are completed, the "go" command should function correctly in the zsh terminal.
The above is the detailed content of Why Doesn't My Mac Terminal Recognize the 'go' Command After Go Installation?. For more information, please follow other related articles on the PHP Chinese website!