#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Getting Started

How to Install Go on Windows, Mac, and Linux – Step-by-Step Setup

Installing Go on Windows

  1. Download the Windows installer (.msi) from the official Go website.
  2. Run the installer and follow the setup wizard — it automatically sets the PATH environment variable.
  3. Open Command Prompt and run go version to confirm installation.

Installing Go on macOS

# Using Homebrew
brew install go

# Verify installation
go version

Installing Go on Linux

wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version

Setting Up Your Workspace

Modern Go uses Go Modules for dependency management, so you no longer need a strict GOPATH directory structure — simply run go mod init myproject inside any folder to start a new project.

Checking That the Installation Really Works

Seeing a version number is a good start, but a quick program confirms that the compiler, module system and PATH all work together. Create a folder anywhere and run these commands:

mkdir hello && cd hello
go mod init example.com/hello
# create main.go with the code below, then:
go run .
go build -o hello .
package main

import "fmt"

func main() {
    fmt.Println("Go is installed and working")
}

go run . compiles and runs in one step. go build produces a standalone executable you can copy to another machine with the same operating system. To see where Go keeps its files, run go env GOROOT GOPATH GOBIN.

Making PATH Changes Permanent

On Linux, the export line only lasts for the current terminal. Add it to your shell profile so it survives a restart. Also add the folder where go install places tools, which is $HOME/go/bin by default.

echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.profile
source ~/.profile

If you use zsh, which is the default on modern macOS, the file is usually ~/.zshrc. On Windows, the installer updates PATH for you, but open a new terminal window afterwards; existing windows still have the old PATH. You can check what Windows sees with where go in Command Prompt.

Upgrading and Troubleshooting

On Linux, the official instructions say to remove the previous installation before extracting a new archive. Extracting on top of an old folder can mix files from two versions and cause confusing build errors.

sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go<version>.linux-amd64.tar.gz

On macOS with Homebrew, brew upgrade go handles this. On Windows, running the newer installer replaces the old version.

SymptomLikely cause and fix
go: command not foundPATH not updated; reload the profile or open a new terminal
Old version still shownTwo installations exist; check with which go or where go and remove one
Installed tools not found$HOME/go/bin (or the GOBIN folder) missing from PATH
Module downloads fail at workA corporate proxy blocks the default module proxy; ask IT for the approved GOPROXY setting
Wrong download for your MacApple silicon needs the arm64 build, Intel Macs need amd64

Editor Setup and a Final Checklist

Visual Studio Code with the official Go extension, or GoLand, gives autocompletion, formatting and debugging. The extension offers to install helper tools such as gopls, the Go language server; accept that prompt. Format code with gofmt or let the editor do it on save, because consistent formatting is a strong Go convention.

  • Download only from the official Go site or a trusted package manager.
  • Confirm go version in a fresh terminal.
  • Run a hello-world module with go run ..
  • Add the Go bin folders to PATH permanently.
  • Install the editor extension and its tools.

Ready to master real-world Go skills?

Learn Go hands-on with mentor-led, live sessions.

Explore Course