How to install Go on your computer

Go is a programming language created by Google that runs on Windows, macOS, and Linux. You download an installer from the official Go website, run it, and the language is ready to use. The whole process takes about five minutes and requires no special configuration afterward.

Go installs into a single folder on your computer and adds itself to your system path automatically, so you can run Go commands from any terminal or command prompt. Once installed, you verify the installation by opening a terminal and typing a single command to check the version number.

Key Takeaways

  • Download the installer matching your operating system from golang.org, not from a third-party source.
  • Windows and macOS installers handle setup automatically; Linux requires extracting a file and setting one environment variable.
  • After installation, open a new terminal window and run go version to confirm Go is working.
  • Go stores downloaded packages in a folder called go/pkg/mod inside your home directory, which you do not need to touch manually.

Installing Go on Windows

Go for Windows comes as an MSI installer file. Visit golang.org, click the download button, and select the Windows option. The file downloads to your Downloads folder — it is named something like go1.21.0.windows-amd64.msi depending on the version.

Double-click the installer file. A setup window appears asking where to install Go; the default location is C:\Program Files\Go, which is correct. Click through the prompts and let the installer finish. Windows automatically adds Go to your system path, so you do not need to configure anything else.

Close any open command prompts or PowerShell windows, then open a new one. Type go version and press Enter. You should see output like go version go1.21.0 windows/amd64. If you see that, Go is installed correctly.

Installing Go on macOS

Go for macOS comes as a PKG installer file. Visit golang.org, click the download button, and select the macOS option. Choose the version matching your Mac — Intel Macs use the amd64 version, and newer Apple Silicon Macs use the arm64 version. The file downloads to your Downloads folder.

Double-click the PKG file. A setup window appears; click through the prompts and enter your password when asked. The installer places Go in /usr/local/go and adds it to your system path automatically. When the installer finishes, close it.

Open a new Terminal window (not the one you may have had open during installation). Type go version and press Enter. You should see output like go version go1.21.0 darwin/arm64 or darwin/amd64 depending on your Mac. If you see that, Go is installed correctly.

Installing Go on Linux

Go for Linux comes as a compressed tar file rather than an installer. Visit golang.org, click the download button, and select the Linux option. The file downloads to your Downloads folder — it is named something like go1.21.0.linux-amd64.tar.gz.

Open a terminal and navigate to your Downloads folder by typing cd Downloads. Extract the tar file by typing tar -xzf go1.21.0.linux-amd64.tar.gz, replacing the version number with whatever you downloaded. This creates a folder called go in your Downloads folder.

Move the go folder to /usr/local by typing sudo mv go /usr/local. You will be asked for your password. Then add Go to your system path by opening your shell configuration file — usually ~/.bashrc or ~/.zshrc depending on which shell you use — and adding this line at the end: export PATH=$PATH:/usr/local/go/bin. Save the file, close your terminal, and open a new one.

Type go version and press Enter. You should see output like go version go1.21.0 linux/amd64. If you see that, Go is installed correctly.

Verifying your installation and finding your workspace

After running go version successfully, you can check where Go is installed by typing go env GOROOT. This shows the folder containing the Go language itself. On Windows it is usually C:\Program Files\Go, on macOS it is /usr/local/go, and on Linux it is /usr/local/go.

Go also creates a workspace folder where it stores packages you download and projects you write. Run go env GOPATH to see where this is. On all three operating systems, it defaults to a folder called go inside your home directory — so C:\Users\YourName\go on Windows, /Users/YourName/go on macOS, and /home/YourName/go on Linux. You do not need to create this folder yourself; Go creates it when you first download a package.

Updating Go to a newer version

When a new version of Go is released, you can update by downloading the new installer from golang.org and running it. On Windows and macOS, the new installer replaces the old one automatically. On Linux, download the new tar file, extract it, and run sudo mv go /usr/local again — it will overwrite the old folder.

Your existing projects and downloaded packages are not affected by updating Go. They remain in your workspace folder and continue to work with the new version in almost all cases.

Troubleshooting installation problems

If you type go version and see a message like "command not found" or "is not recognized", Go is not in your system path. On Windows, restart your computer — the installer adds Go to the path, but Windows does not recognize the change until you restart. On macOS and Linux, close your terminal completely and open a new one, since the path is read when the terminal starts.

If you downloaded Go from a website other than golang.org, delete it and download again from the official source. Third-party downloads may be outdated or modified. If you are on Linux and extracted the tar file to the wrong location, move the go folder to /usr/local and check that your shell configuration file contains the correct PATH line.

Frequently Asked Questions

Do I need to install anything else before installing Go?

No. Go is self-contained and works on its own. You do not need a compiler, a build system, or any other language installed first. You can start writing Go programs immediately after installation.

Can I install multiple versions of Go at the same time?

Yes, but only one version can be in your system path at a time. To switch between versions, you would need to change your PATH variable or use a version manager tool. Most people install only one version and update it when a new release comes out.

What if the installer says I do not have permission to install?

On Windows, right-click the MSI file and select "Run as administrator". On macOS, the installer will ask for your password — enter it. On Linux, use sudo when moving the go folder to /usr/local, as shown in the installation steps.

Where do I write Go programs after installing?

You can write Go programs anywhere on your computer. A common practice is to create a folder inside your workspace — for example, go/src/myproject — but this is not required. Go will find and run your programs from any location.

Is Go free to download and use?

Yes. Go is open source and free. There are no license fees, subscriptions, or restrictions on using it for personal or commercial projects.