Learn how to install Golang (Go) on Windows, macOS, and Linux. This beginner-friendly guide walks you through each step to get started with Golang quickly.

Installing Go: Let's get Started!


Learn how to install Golang (Go) on Windows, macOS, and Linux. This beginner-friendly guide walks you through each step to get started with Golang quickly.

If you’re diving into Go (often referred to as Golang), the first step is installing the programming language on your machine. Whether you’re using Windows, macOS, or Linux, this guide will walk you through the process of installing Golang quickly and efficiently.

Why Choose Go?

Before jumping into the installation steps, let’s take a moment to understand why Go has become a popular language:

  • Fast and efficient: Go is designed for speed!
  • Concurrency: Go has in-built support for concurrent programming, making it ideal for systems that need scale.
  • Simplicity: it’s very easy to learn.
  • Cross-platform: Write once, run anywhere—Go supports multiple platforms.

Let’s install it!

Installing Golang on Windows

Step 1: Download Golang

  1. Head to the official page to download it.
  2. Select the appropriate installer for Windows (.msi file).
  3. Once the download is complete, run the installer.

That’s really it!

Step 2: Install Golang

  1. Follow the on-screen instructions in the installer to install Go.
  2. The default installation path is C:Go. You can change it, but it’s recommended to keep the default path.

Step 3: Set Up Environment Variables

To ensure you can run go commands from any terminal window, add Go’s binary directory to your PATH.

  1. Right-click on This PC or My Computer, and click Properties.
  2. Click on Advanced system settings, then Environment Variables.
  3. In the System variables section, find the Path variable, select it, and click Edit.
  4. Click New, and enter the path to Go’s bin directory (C:Gobin by default).
  5. Click OK to save and close.

Step 4: Verify Installation

Open a command prompt and type:

go version

If the installation was successful, you should see the installed Go version displayed.

Installing Golang on macOS

Step 1: Download Golang

  1. Visit the official Go Downloads page.
  2. Download the .pkg installer for macOS.

Step 2: Install Golang

  1. Run the .pkg file and follow the instructions to install Go on your Mac.
  2. The installer will automatically install Go to /usr/local/go.

Step 3: Set Up Environment Variables

To ensure Go works from your terminal, add it to your PATH.

  1. Open the Terminal.
  2. Run the following command to add Go to your path in your .bash_profile or .zshrc file:
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bash_profile
source ~/.bash_profile

Step 4: Verify Installation

Once the installation is complete, verify it by running:

go version

You should see the Go version printed in the terminal.

Installing Golang on Linux

Step 1: Download Golang

Go to the official Go Downloads page and download the latest .tar.gz archive for Linux.

Step 2: Install Golang

  1. Open a terminal and navigate to the directory where the .tar.gz file was downloaded.
  2. Extract the archive and move it to /usr/local:
sudo tar -C /usr/local -xzf go1.x.x.linux-amd64.tar.gz

(Replace go1.x.x with the actual version you downloaded.)

Step 3: Set Up Environment Variables

Add Go’s bin directory to your PATH.

  1. Open your shell profile (.bashrc, .bash_profile, or .zshrc).
  2. Add the following line:
export PATH=$PATH:/usr/local/go/bin
  1. Save the file and reload it:
source ~/.bashrc

Step 4: Verify Installation

Check if Go is installed correctly:

go version

Wrapping Up

Installing Golang is pretty easy on any operating system.

Now that you have Go installed, you can start exploring - this website has books, courses, and blog posts that can help so have a click around.