How to Install GO (Mac • Windows • Linux)
macOS
Option A — Official pkg (recommended)
- Download “macOS pkg installer” from go.dev/dl
- Run the installer (works on Intel & Apple Silicon).
- Verify:
go version
Option B — Homebrew
brew install go
go version
(Optional) Set up your Go workspace
# Add to ~/.zshrc (or ~/.bashrc)
echo 'export GOPATH="$HOME/go"' >> ~/.zshrc
echo 'export GOBIN="$GOPATH/bin"' >> ~/.zshrc
echo 'export PATH="$PATH:$GOBIN"' >> ~/.zshrc
source ~/.zshrc
Windows
Option A — Winget (fastest)
winget install -e --id GoLang.Go
go version
Option B — Chocolatey
choco install golang -y
go version
Option C — Official MSI
- Download the Windows installer from go.dev/dl and run it.
- Open a new PowerShell or Command Prompt:
go version
(Optional) GOPATH
- By default on Windows,
GOPATHisC:\Users\<You>\go. - To use
GOBINon your PATH:
setx GOPATH "$env:USERPROFILE\go"
setx GOBIN "$env:GOPATH\bin"
# Add to PATH for the current session:
$env:Path += ";$env:GOBIN"
Linux
Debian/Ubuntu (apt)
sudo apt update
sudo apt install -y golang
go version
Fedora
sudo dnf install -y golang
go version
Arch
sudo pacman -S --needed go
go version
(Optional) Official tarball (all distros)
# Replace X.Y.Z with the latest version for your architecture
sudo rm -rf /usr/local/go
curl -L https://go.dev/dl/goX.Y.Z.linux-amd64.tar.gz | sudo tar -C /usr/local -xz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
go version
Quick sanity test
mkdir -p ~/tmp/hello && cd ~/tmp/hello
cat > main.go << 'EOF'
package main
import "fmt"
func main(){ fmt.Println("hello, ship-securely") }
EOF
go run .
Common hiccups
Open a new shell after install so your PATH updates.
If
go: command not found, ensure Go’sbindirectory is on PATH:- macOS pkg:
/usr/local/go/bin(Intel) or/opt/homebrew/opt/go/libexec/bin(Brew) - Linux tarball:
/usr/local/go/bin - Windows MSI/winget sets PATH automatically; reopen the terminal.
- macOS pkg: