Skip to content

Installing Go

To start programming in Go, you need to install the Go toolchain (compiler, standard library, and command‑line tools). Go supports Linux, macOS, Windows, and several other platforms.

  1. Download the latest tarball from go.dev/dl, e.g., go1.24.0.linux-amd64.tar.gz.
  2. Remove any previous Go installation (usually /usr/local/go):
    Terminal window
    sudo rm -rf /usr/local/go
  3. Extract the tarball into /usr/local:
    Terminal window
    sudo tar -C /usr/local -xzf go1.24.0.linux-amd64.tar.gz
  4. Add /usr/local/go/bin to your PATH environment variable (add to ~/.profile or ~/.bashrc):
    Terminal window
    export PATH=$PATH:/usr/local/go/bin
  • Using the official installer: download the .pkg file from go.dev/dl and run it.
  • Using Homebrew: brew install go.
  • Download the MSI installer from go.dev/dl and run it. It will automatically set up the PATH environment variable.

After installation, open a new terminal and run:

Terminal window
go version
go version go1.24.0 linux/amd64

Check the Go environment:

Terminal window
go env

This shows variables like GOROOT (installation path), GOPATH (legacy workspace, not needed with modules), and GOOS/GOARCH.