Skip to main content

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

Download the Archive

1

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.
2

Remove Previous Installation

If you have a previous installation, remove it first:
sudo rm -rf /usr/local/go
3

Extract the Archive

Extract the archive to /usr/local:
sudo tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz
4

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:
source ~/.profile
5

Verify Installation

Check that Go is installed correctly:
go version
You should see output like: go version go1.23.0 linux/amd64

Using a Package Manager

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.

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:
go env
Key environment variables:
VariableDescription
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:
1

Create a Directory

mkdir -p ~/hello
cd ~/hello
2

Initialize a Module

go mod init example/hello
3

Create hello.go

Create a file named hello.go:
package main

import "fmt"

func main() {
    fmt.Println("hello, world")
}
4

Run the Program

go run hello.go
You should see:
hello, world
Congratulations! Go is installed and working correctly.

Update Go

To update to a newer version of Go:
1

Download New Version

Download the latest version from go.dev/dl
2

Remove Old Version

sudo rm -rf /usr/local/go
3

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

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”:
  1. Verify Go is in your PATH: echo $PATH (Linux/macOS) or echo %PATH% (Windows)
  2. Restart your terminal
  3. 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

Build docs developers (and LLMs) love