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
Barbara StreisandOriginal
2024-12-04 22:26:13888browse

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

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!

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