Installing Go

Installing Go on macOS and Linux

Installation

For a quick test, use The Go Playground. To install Go locally, follow the instructions below.

Installing on macOS

Installing with the package installer

  1. Download an installer from the official installation page. For a specific version or another operating system, use Other downloads.
  2. Open the downloaded go1.xx.darwin-arm64.pkg or go1.xx.darwin-amd64.pkg file and complete the installation.
  3. Open Terminal and verify the installation:
% go version
go version go1.26.3 darwin/arm64

Removing a package installation

Check the installation path:

% which go
/usr/local/go/bin/go

Remove the related files:

% sudo rm -rf /usr/local/go
% sudo rm /etc/paths.d/go

Installing with Homebrew

See the Homebrew Go formula.

% brew install go

Installing on Linux

Distribution packages

CentOS 7:

$ yum install -y epel-release
$ yum install -y golang
$ go version

CentOS 8:

$ dnf install -y golang

Ubuntu:

$ sudo apt-get install -y golang

Official Linux archive

Check the current version and architecture-specific file name on the official downloads page. Remove an existing /usr/local/go directory before extracting a new archive.

$ wget https://go.dev/dl/go1.26.3.linux-amd64.tar.gz
$ sudo rm -rf /usr/local/go
$ sudo tar -C /usr/local -xzf go1.26.3.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin
$ go version