Download Go from go.dev/dl, run the installer for your system, open a new terminal, and run go version. That is the whole install on Windows and macOS. On Linux you extract a tarball and add one directory to your PATH. The sections below cover each system, then the checks and the errors people actually hit.
You do not need Go installed to try it. This program runs in your browser, on the same Go release the site uses, and reports what it is running on:
Once Go is installed locally, the same program prints your own machine's details.
Which Download to Pick
The download page lists one file per operating system and CPU architecture:
| System | File | Notes |
|---|---|---|
| Windows, most PCs | go1.24.5.windows-amd64.msi | amd64 means 64-bit Intel or AMD |
| Windows on ARM | go1.24.5.windows-arm64.msi | Surface Pro X, Snapdragon laptops |
| macOS, Apple Silicon (M1 and later) | go1.24.5.darwin-arm64.pkg | darwin is macOS |
| macOS, Intel | go1.24.5.darwin-amd64.pkg | |
| Linux, most servers and PCs | go1.24.5.linux-amd64.tar.gz | |
| Linux on ARM | go1.24.5.linux-arm64.tar.gz | Raspberry Pi 4 and 5 with a 64-bit OS, AWS Graviton |
The version number in these examples is 1.24.5. Take whatever the newest stable release is; the steps do not change between versions.
Install Go on Windows
- Download the
.msifile and run it. - Accept the defaults. Go installs into
C:\Program Files\Goand the installer addsC:\Program Files\Go\binto yourPATH. - Close every open Command Prompt or PowerShell window and open a new one. Terminals that were open during the install still have the old
PATH. - Check the install:
go version
go version go1.24.5 windows/amd64
winget works too, if you prefer a package manager:
winget install GoLang.Go
Install Go on macOS
With the official package
Download the .pkg for your chip and open it. It installs Go into /usr/local/go and adds /usr/local/go/bin to your PATH through the file /etc/paths.d/go. Open a new Terminal window, then:
go version
go version go1.24.5 darwin/arm64
With Homebrew
brew install go
go version
Homebrew puts Go under its own prefix (/opt/homebrew on Apple Silicon) and links go into a directory that is already on your PATH. Upgrade later with brew upgrade go.
Pick one method. Having both the .pkg and Homebrew installs means two go binaries on your PATH, and whichever comes first wins. which go tells you which one your shell is using.
Install Go on Linux and Ubuntu
The official method works on every distribution. Remove any previous install first, because extracting over an old tree mixes files from two versions and breaks the toolchain:
cd ~/Downloads
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.24.5.linux-amd64.tar.gz
Then add Go to your PATH. Append this line to ~/.profile (bash) or ~/.zshrc (zsh):
export PATH=$PATH:/usr/local/go/bin
Load it into the current shell and check:
source ~/.profile
go version
go version go1.24.5 linux/amd64
Ubuntu packages: apt and snap
Ubuntu offers two shortcuts, with different trade-offs:
# Distribution package: easy, but usually several releases old
sudo apt install golang-go
# Snap: tracks current Go releases
sudo snap install go --classic
The apt version matters more than it looks. Modules declare a minimum Go version in go.mod. From Go 1.21 on, a module that says go 1.23 will not build with an older toolchain unless Go can download a newer one for you, and toolchains older than 1.21 attempt the build anyway and fail on whatever newer feature they meet first (see "Keeping Go up to date" below). If you install from apt, run go version and compare it with go.dev/dl.
Check the Installation
Three commands confirm a working setup:
go version
go env GOROOT GOPATH
which go
go version go1.24.5 linux/amd64
/usr/local/go
/home/ana/go
/usr/local/go/bin/go
GOROOTis where Go itself is installed. Never put your own code there, and you should not need to set it.GOPATHdefaults to$HOME/go(%USERPROFILE%\goon Windows). Go stores downloaded modules in$GOPATH/pkg/modand puts programs built bygo installin$GOPATH/bin.which go(where goon Windows) shows the exact binary your shell runs. Use it whenevergo versionreports a version you did not expect.
Run Your First Program
Your code can live in any directory. Create a folder, start a module, and write a file:
mkdir hello
cd hello
go mod init example.com/hello
go: creating new go.mod: module example.com/hello
Save this as main.go in that folder:
Then run it:
go run .
Go is installed and working.
go run . compiles the package in the current directory and runs it. The hello world page explains each line of the program, and the go mod init step is covered in Go modules.
Add GOPATH/bin to PATH
Tools installed with go install go into $HOME/go/bin, which is not on your PATH by default. If you install a tool and the shell says it cannot find it, add that directory too:
go install golang.org/x/tools/cmd/goimports@latest
export PATH=$PATH:$(go env GOPATH)/bin
goimports -h
Put the export line in ~/.profile or ~/.zshrc so it survives new terminals. On Windows the installer already adds %USERPROFILE%\go\bin to your user PATH.
Keeping Go Up to Date
To upgrade, install the new release the same way you installed the old one. On Linux, that means repeating the rm -rf /usr/local/go and tar steps; do not skip the removal.
Since Go 1.21 the go command can also fetch a newer toolchain on demand. If a module's go.mod says go 1.24 and you have Go 1.22 installed, running go build downloads Go 1.24 into the module cache and uses it, as long as GOTOOLCHAIN is left at its default of auto. Your installed Go stays the same; only that module builds with the newer release.
To keep an older version around for testing, install it side by side:
go install golang.org/dl/go1.23.4@latest
go1.23.4 download
go1.23.4 version
Common Install Errors
go: command not found or zsh: command not found: go. The shell cannot find the binary. On Linux, check that /usr/local/go/bin is in the export PATH line of the file your shell actually reads (~/.zshrc for zsh, ~/.profile or ~/.bashrc for bash), then open a new terminal. Run echo $PATH to see what the shell has.
'go' is not recognized as an internal or external command (Windows). Close and reopen the terminal. If it persists, open "Edit the system environment variables", click Environment Variables, and make sure C:\Program Files\Go\bin is in Path. VS Code's built-in terminal inherits the environment VS Code started with, so restart VS Code too.
go version shows the old version after an upgrade. Two installs are on your PATH. Run which -a go (or where go on Windows) and remove the one you do not want, often an apt package at /usr/bin/go shadowing /usr/local/go/bin/go.
go: go.mod file not found in current directory or any parent directory. Go is installed correctly; you ran go build or go run . outside a module. Run go mod init example.com/yourname in the project folder first.
Strange compile errors in the standard library after an upgrade on Linux. The new tarball was extracted on top of the old tree. Delete /usr/local/go completely and extract again.
Permission denied when extracting. /usr/local is owned by root, so the rm and tar commands need sudo. Your own code never needs sudo.
Editor Setup
Any editor works, but install Go support so you get completion, error highlighting and formatting on save. In VS Code, install the official Go extension (published by the Go team at Google); it offers to install gopls, the Go language server, the first time you open a .go file. GoLand from JetBrains is the main commercial option. Vim and Neovim use gopls through their LSP clients.
Frequently Asked Questions
How do I install Golang?
Download the installer for your system from go.dev/dl. On Windows run the .msi, on macOS run the .pkg (or brew install go), and on Linux extract the tarball into /usr/local and add /usr/local/go/bin to your PATH. Open a new terminal and run go version to confirm.
How do I fix "go: command not found"?
The shell cannot find the go binary on your PATH. On Linux add export PATH=$PATH:/usr/local/go/bin to ~/.profile (or ~/.zshrc for zsh), then open a new terminal. On Windows and macOS installers the fix is usually just to close and reopen the terminal, because a terminal keeps the PATH it started with.
How do I install Go on Ubuntu?
Use the official tarball: sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.24.5.linux-amd64.tar.gz, then add /usr/local/go/bin to PATH. sudo apt install golang-go also works, but Ubuntu's package is often several releases behind. sudo snap install go --classic tracks current releases.
Do I need to set GOPATH?
No. Since Go 1.16, module mode is the default, so your code can live in any directory. GOPATH defaults to $HOME/go and is only used for the module download cache and for binaries that go install builds, which land in $HOME/go/bin.
How do I check which version of Go is installed?
Run go version. It prints something like go version go1.24.5 linux/amd64: the release, then the operating system and CPU architecture. go env shows the full configuration, including GOROOT (where Go is installed) and GOPATH.