How to Install Go (Golang) on Any Operating System

Go — often called Golang — is an open-source programming language developed by Google. It's fast, statically typed, and built with concurrency in mind, making it a popular choice for backend development, CLI tools, cloud infrastructure, and networked services. Installing it correctly sets the foundation for everything that follows, and the process varies meaningfully depending on your operating system and how you plan to use it.

What You're Actually Installing

When you install Go, you're getting the Go toolchain — a collection of command-line tools that includes:

  • go build — compiles Go source code into executables
  • go run — compiles and runs a program in one step
  • go mod — manages dependencies via Go modules
  • gofmt — formats your code to the official style standard

All of these live under a single installation directory. Unlike some languages that separate the runtime from the compiler, Go bundles everything together, which keeps setup relatively straightforward.

Before You Start: Key Variables to Know

Your installation path depends on a few factors:

VariableWhy It Matters
Operating systemWindows, macOS, and Linux each have different installers and PATH configurations
System architecturex86-64, ARM64 (Apple Silicon, Raspberry Pi), and 32-bit systems need different binaries
Go version neededSome projects require a specific Go version; others just need "latest stable"
Installation methodOfficial installer vs. package manager vs. manual tarball extraction
Development environmentVSCode, Vim, GoLand, and others each have their own Go tooling integrations

Knowing your architecture matters more than most people expect. An ARM64 Mac running Apple Silicon needs a different binary than an Intel Mac, and using the wrong one will either fail outright or run under Rosetta 2 emulation with reduced performance.

Installing Go on Windows

The most common approach on Windows is the official MSI installer from go.dev/dl. Download the .msi file matching your architecture (amd64 for most modern PCs), run it, and the installer handles:

  • Extracting Go to C:Program FilesGo by default
  • Adding Go's bin directory to your system PATH automatically
  • Setting the GOROOT environment variable

After installation, open a new Command Prompt or PowerShell window and run go version to confirm everything is working. A fresh terminal session is required because the PATH change doesn't propagate to windows that were already open.

Windows Subsystem for Linux (WSL) users are better served by following the Linux instructions inside their WSL environment rather than using the Windows installer.

Installing Go on macOS 🍎

macOS offers two practical routes:

Option 1 — Official PKG installer: Download the .pkg file from go.dev/dl and run it. This installs Go to /usr/local/go and modifies /etc/paths.d/go to update your PATH. It works cleanly on both Intel and Apple Silicon Macs, as long as you download the correct architecture binary.

Option 2 — Homebrew: Running brew install go installs the latest stable version and integrates with Homebrew's update system. This is popular among developers who already use Homebrew for other tools, since brew upgrade go keeps the toolchain current without manual downloads.

The tradeoff: Homebrew installations sometimes lag a few days behind official releases. For most developers this is irrelevant, but if you need a specific patch version immediately, the official installer is more predictable.

After installation, verify with go version in Terminal.

Installing Go on Linux

Linux installations are typically done by extracting the official tarball. The general process:

  1. Download the .tar.gz for your architecture from go.dev/dl
  2. Remove any previous Go installation: sudo rm -rf /usr/local/go
  3. Extract the archive: sudo tar -C /usr/local -xzf go1.x.x.linux-amd64.tar.gz
  4. Add Go to your PATH by appending export PATH=$PATH:/usr/local/go/bin to your shell profile (.bashrc, .zshrc, .profile, or equivalent)
  5. Reload the shell: source ~/.bashrc (or equivalent)
  6. Confirm: go version

Package managers like apt (Debian/Ubuntu) do offer Go packages, but they often ship older versions that lag significantly behind the current release. If you're working on modern Go projects, the tarball method gives you more control.

Understanding GOPATH and Go Modules 🗂️

Earlier versions of Go relied heavily on a workspace directory called GOPATH (defaulting to ~/go). Modern Go development — anything from Go 1.16 onward — uses Go modules instead, which allows projects to live anywhere on your filesystem.

You still have a ~/go directory, but its role has shifted:

  • ~/go/bin — where globally installed tools (like gopls, the Go language server) land
  • ~/go/pkg — module cache storage

For new projects, you initialize a module with go mod init <module-name> inside your project directory. This creates a go.mod file that tracks your dependencies, similar to package.json in Node.js or requirements.txt in Python.

Managing Multiple Go Versions

Some developers need to switch between Go versions — for instance, maintaining a legacy service while building a new project on the latest stable release. Tools like go install golang.org/dl/go1.x.x@latest let you download and use specific versions alongside your primary installation.

Third-party version managers also exist for Go, though the language's own toolchain has added more version management features over time, reducing the urgency of external tools.

Verifying Your Installation

After any installation method, a few commands confirm your environment is healthy:

go version # shows installed version and architecture go env GOROOT # shows where Go is installed go env GOPATH # shows your workspace directory go env GOMODCACHE # shows where downloaded modules are cached 

If go version returns an error, the most common cause is that the bin directory wasn't added to PATH correctly, or the terminal session predates the PATH change.

What Differs by Developer Profile

A developer running a single personal project on a modern Mac or Windows machine will have a simpler path than someone managing Go installations across a CI/CD pipeline, Docker containers, or multiple Linux servers. In those environments, the installation method, version pinning strategy, and environment variable configuration each become significantly more deliberate choices.

Your specific OS version, architecture, project requirements, and whether you're working solo or in a team all shape which approach actually fits — and that part only becomes clear when you look at your own setup.