Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrin
Last active March 7, 2024 12:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelCurrin/5e2bafa7aa4895e56aeb489c91d314d4 to your computer and use it in GitHub Desktop.
Save MichaelCurrin/5e2bafa7aa4895e56aeb489c91d314d4 to your computer and use it in GitHub Desktop.
Install Go binary manually

Install Go binary manually

The instructions here work on Linux and macOS and use curl or wget to download Go. If you prefer to use a package manager, see this gist.

Download and install from the Go website:

  1. Find a release on Go site's Downloads page.
  2. Download Go using the URL.
    $ cd ~/Downloads
    $ wget URL
    $ # Or
    $ curl -O URL
  3. Unzip the downloaded tar file. The docs recommend removing the old Go directory first when upgrading.
    • Shared directory.
      $ sudo rm -rf /usr/local/go
      $ sudo tar -C /usr/local -xzf TAR_PATH
    • Or a user directory.
      $ rm -rf ~/.local/go
      $ tar -C ~/.local/ -xzf TAR_PATH
  4. Set up your path in your shell config (.profile, .bashrc or .zshrc). There is a go executable in the bin directory which must be accessible.
    • Shared directory.
      export PATH="/usr/local/go/bin:$PATH"
    • Or a user directory.
      export PATH="$HOME/.local/go/bin:$PATH"
  5. Start a new terminal tab and then test your installation:
    $ go version

Another option for macOS is to download the installer that is available from the Downloads page and when you open the .pkg file you'll get an installer GUI. Follow the prompts. It will install to /usr/local/go and add /usr/local/go/bin to your path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment