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

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

Barbara Streisand
Release: 2024-12-04 22:26:13
Original
857 people have browsed it

Why Doesn't My Mac Terminal Recognize the

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

Source ~/.zshrc File:

After modifying the ~/.zshrc file, execute the following command to refresh the terminal configuration:

. ~/.zshrc
Copy after login

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!

source:php.cn
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