Home > Backend Development > Golang > Why Doesn't 'go version' Work After Installing Go on My Mac?

Why Doesn't 'go version' Work After Installing Go on My Mac?

Mary-Kate Olsen
Release: 2024-12-02 05:16:13
Original
764 people have browsed it

Why Doesn't

Resolving "Command not found go" Prompt after Installing Go on Mac

Despite installing Go on your Mac, attempts to execute the "go version" command result in the error "command not found: go." This error persists despite modifying your bash profile with the path "export PATH=$PATH:/usr/local/go/bin."

To rectify this issue, follow these steps:

  1. Open your ~/.zshrc file.
  2. Add the following lines:

    export PATH=$PATH:/usr/local/go/bin
    export PATH=$PATH:$GOPATH/bin
    Copy after login
  3. Save the .zshrc file.
  4. Refresh the .zshrc file by executing the command:

    . ~/.zshrc
    Copy after login
  5. Verify that the error is resolved and the "go version" command can now be executed successfully.

By modifying the ~/.zshrc file and adding the appropriate path, the Mac will recognize the Go executable and allow you to utilize the Go command-line tools.

The above is the detailed content of Why Doesn't 'go version' Work After Installing Go on My Mac?. 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