Skip to main content

Installing Go

Get Go installed on your system and configure your development environment. Choose your operating system below to get started.

Install Go on macOS

Quick Install with Homebrew

If you have Homebrew installed, you can easily install Go with these commands:
# Install Git (if you don't have it)
brew install git

# Install Go
brew install go

# Add GOBIN path to your PATH in ~/.bash_profile or ~/.zshrc
export PATH=${HOME}/go/bin:$PATH

Manual Installation

1

Install Visual Studio Code

  1. Go to https://code.visualstudio.com
  2. Select macOS and download
  3. Uncompress the downloaded file
  4. Move it to your ~/Applications directory
2

Install Git

  1. Download from https://git-scm.com/downloads
  2. Run the installer
  3. Select VSCode as the default editor
3

Install Go

  1. Go to https://golang.org/dl
  2. Select macOS
  3. Run the installer package
4

Configure VS Code

  1. Open VS Code
  2. From the extensions tab, search for “go” and install the official Go extension
  3. Close and reopen VS Code
  4. Open the Command Palette (cmd+shift+p)
  5. Type: go install
  6. Select “Go: Install/Update Tools”
  7. Check all the checkboxes and install
  8. Open Command Palette again
  9. Type: shell
  10. Select: “Install ‘code’ command in PATH”
5

Verify Installation

Open your terminal and run:
go version
You should see output like: go version go1.x.x darwin/amd64

Workspace Setup

After installation, you’ll want to organize your Go projects:
With Go modules (Go 1.11+), you can create Go projects anywhere on your system. You don’t need to follow the old GOPATH structure.
~/projects/
  ├── learngo/          # Your learning projects
  │   ├── hello/
  │   ├── variables/
  │   └── ...
  └── myapp/            # Your own projects

Create Your First Project Directory

# Create a projects directory
mkdir -p ~/projects/learngo

# Navigate to it
cd ~/projects/learngo

Next Steps

Now that you have Go installed, you’re ready to write your first program!

Write Your First Program

Learn how to create and run a simple Go program

Build docs developers (and LLMs) love