Home >Backend Development >Golang >Why Doesn't My Mac Recognize the `go` Command After Go Installation?

Why Doesn't My Mac Recognize the `go` Command After Go Installation?

Susan Sarandon
Susan SarandonOriginal
2024-12-02 19:15:16462browse

Why Doesn't My Mac Recognize the `go` Command After Go Installation?

"Command not found go" on Mac After Installing Go

Upon installing Go and attempting to run the "go version" command, many users encounter the error message "zsh: command not found: go." This can be frustrating, especially after trying multiple solutions like adding the path to the bash profile and reinstalling Go.

To resolve this issue, adding the path to "~/.zshrc" is necessary.

In the "~/.zshrc" file, add these lines:

export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$GOPATH/bin

Then, source the "~/.zshrc" file:

. ~/.zshrc

Following these steps ensures that the path is properly added to the user's profile, allowing the "go" command to be recognized and executed.

The above is the detailed content of Why Doesn't My Mac Recognize the `go` Command After Go Installation?. 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