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
Release: 2024-12-02 19:15:16
Original
565 people have browsed it

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
Copy after login

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

. ~/.zshrc
Copy after login

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 of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template