System Requirements
Go supports the following operating systems and architectures:
Linux : AMD64, 386, ARM, ARM64, PPC64, S390X
macOS : AMD64 (Intel), ARM64 (Apple Silicon)
Windows : AMD64, 386, ARM, ARM64
FreeBSD : AMD64, 386, ARM
OpenBSD : AMD64, 386, ARM
Go requires a 64-bit operating system for most platforms. 32-bit support is available but limited.
Installation Methods
Linux
macOS
Windows
Docker
Download the Archive
Download Go
Download the latest Go release for Linux: wget https://go.dev/dl/go1.23.0.linux-amd64.tar.gz
Check go.dev/dl for the latest version number.
Remove Previous Installation
If you have a previous installation, remove it first: sudo rm -rf /usr/local/go
Extract the Archive
Extract the archive to /usr/local: sudo tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz
Update Your PATH
Add Go to your PATH by adding this to your ~/.profile or ~/.bashrc: export PATH = $PATH :/ usr / local / go / bin
Apply the changes:
Verify Installation
Check that Go is installed correctly: You should see output like: go version go1.23.0 linux/amd64 Using a Package Manager Ubuntu/Debian
Fedora
Arch Linux
Snap
sudo apt update
sudo apt install golang-go
Package manager versions may lag behind the official releases. For the latest version, use the official tarball.
Using the Installer
Download the Package
Download the macOS installer from go.dev/dl :
Apple Silicon (M1/M2/M3) : go1.23.0.darwin-arm64.pkg
Intel : go1.23.0.darwin-amd64.pkg
Run the Installer
Open the downloaded .pkg file and follow the prompts. The installer will:
Install Go to /usr/local/go
Add /usr/local/go/bin to your PATH
Verify Installation
Open a new terminal and verify: Using Homebrew If you use Homebrew, you can install Go with: Then verify the installation: Homebrew installs Go to /opt/homebrew/bin/go (Apple Silicon) or /usr/local/bin/go (Intel) and automatically updates your PATH.
Using the MSI Installer
Download the Installer
Download the Windows installer from go.dev/dl :
64-bit : go1.23.0.windows-amd64.msi
32-bit : go1.23.0.windows-386.msi
ARM64 : go1.23.0.windows-arm64.msi
Run the Installer
Open the MSI file and follow the installation wizard. By default, Go installs to: The installer automatically adds C:\Program Files\Go\bin to your PATH.
Verify Installation
Open a new Command Prompt or PowerShell window and run: Using Chocolatey If you use Chocolatey package manager: Using Scoop If you use Scoop package manager: Official Go Images Use the official Go Docker images for development or building applications: # Pull the latest Go image
docker pull golang:latest
# Run Go in a container
docker run -it golang:latest
Version-Specific Images # Use a specific Go version
docker pull golang:1.23.0
# Alpine-based image (smaller)
docker pull golang:1.23.0-alpine
Build Your Application Example Dockerfile for a Go application: FROM golang:1.23.0 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o myapp
FROM alpine:latest
WORKDIR /root/
COPY --from=builder /app/myapp .
CMD [ "./myapp" ]
Environment Setup
After installing Go, configure your development environment:
GOPATH and Workspace
Go uses a workspace directory for your projects. By default:
Linux/macOS : ~/go
Windows : %USERPROFILE%\go
The workspace contains:
$GOPATH/
├── bin/ # Compiled executables
├── pkg/ # Package objects
└── src/ # Source files (deprecated with modules)
With Go modules (the modern approach), you can work anywhere. You don’t need to use GOPATH for your projects.
Set GOPATH (Optional)
To customize your workspace location:
export GOPATH = $HOME / my-go-workspace
export PATH = $PATH : $GOPATH / bin
Go Environment Variables
View all Go environment variables:
Key environment variables:
Variable Description GOROOTLocation of Go installation GOPATHWorkspace directory GOBINWhere go install puts binaries GOOSTarget operating system GOARCHTarget architecture GO111MODULEModule support (on by default)
Verify Your Installation
Create a simple program to test your setup:
Create a Directory
mkdir -p ~/hello
cd ~/hello
Initialize a Module
go mod init example/hello
Create hello.go
Create a file named hello.go: package main
import " fmt "
func main () {
fmt . Println ( "hello, world" )
}
Congratulations! Go is installed and working correctly.
Update Go
To update to a newer version of Go:
Remove Old Version
sudo rm -rf /usr/local/go
Install New Version
Follow the same installation steps as above for your platform
Uninstall Go
To completely remove Go:
# Remove Go installation
sudo rm -rf /usr/local/go
# Remove from PATH (edit ~/.profile or ~/.bashrc)
# Remove this line: export PATH=$PATH:/usr/local/go/bin
# Optionally remove workspace
rm -rf ~/go
Use Add or Remove Programs to uninstall Go
Or manually delete C:\Program Files\Go
Remove C:\Program Files\Go\bin from your PATH
Optionally delete %USERPROFILE%\go
Next Steps
Quick Start Guide Write your first Go program
Tutorial Learn Go fundamentals with a hands-on tutorial
Editor Setup Configure your IDE or editor for Go development
Standard Library Explore the standard library packages
Troubleshooting
Command Not Found
If you get “go: command not found”:
Verify Go is in your PATH: echo $PATH (Linux/macOS) or echo %PATH% (Windows)
Restart your terminal
Check the installation directory exists
Permission Denied
On Linux/macOS, ensure /usr/local/go is accessible:
sudo chown -R $USER /usr/local/go
Import Errors
If you get package import errors, ensure you’re using Go modules:
go mod init your-module-name
go mod tidy