Installing a Go Development Environment¶
This guide sets up Git, Go, and a code editor, then has you write and run your first Go program. By the end you'll have a working Go environment and a program printing to your terminal. Once done, you can go back to the instructions for installing goxpyriment
What you'll do
- Install the tools for your operating system — macOS · Windows · Linux (Ubuntu)
- Write and run your first program
- (Optional) Install Claude Code, an AI coding assistant
macOS¶
If Homebrew is installed, you can install Git and Go with two commands:
Otherwise, follow the steps below.
1. Install Apple Command Line Tools¶
Before installing anything else, macOS needs its basic developer foundation.
- Open your Terminal (press
Cmd + Spaceand type "Terminal"). - Run:
- A popup will appear — click Install and agree to the terms.
2. Install Git¶
macOS ships with an outdated Git; install the official version.
- Download: Go to git-scm.com/download/mac.
- Use the binary installer package.
- Verify:
3. Install Go¶
- Download: Visit go.dev/dl and select the macOS installer (
.pkg). - Apple Silicon (M1/M2/M3/…): choose ARM64.
- Intel Mac: choose x86-64.
- Open the package and follow the wizard.
- Verify (open a new Terminal window):
4. Editor: Visual Studio Code (VS Code)¶
If you do not already have a favourite editor (Vim or Emacs work great too), install VS Code.
- Download: code.visualstudio.com.
- Unzip the download and drag Visual Studio Code into your Applications folder.
- Add the
codecommand to PATH: - Open VS Code, press
Cmd + Shift + P. - Type
shell commandand select "Shell Command: Install 'code' command in PATH". - Install the Go extension:
- Click the Extensions icon (four squares) in the left sidebar.
- Search for "Go" and install the one by the Go Team at Google.
✅ Tools installed. Continue to Your First Program.
Windows¶
1. Install Git¶
- Download: git-scm.com/download/win.
- Run the
.exeinstaller. On most screens you can click Next, but note: - Editor: select "nano" if it not the default (you can change it later).
- PATH: select "Git from the command line and also from 3rd-party software".
- Line endings: choose "Checkout Windows-style, commit Unix-style line endings".
- Verify — open Command Prompt (
Win + R, typecmd) and run:
2. Install Go¶
- Download: go.dev/dl — choose the Windows installer (
.msi). - Run the installer; it defaults to
C:\Program Files\Go. - Close any open Command Prompts, then open a new one.
- Verify:
You should see something like
go version go1.26.x windows/amd64.
3. Editor¶
Any text editor works. If you are new to programming, start with one of the simpler options below and switch later if you outgrow it.
Notepad++ (simplest) — tiny and instant, with Go syntax highlighting. Ideal if you just want to edit a file (no autocomplete or error checking).
- Download: notepad-plus-plus.org.
- Run the installer and accept the defaults.
Zed (lightweight, with Go support) — a fast, uncluttered editor that still gives you autocomplete and inline error checking.
- Download: zed.dev.
- Run the installer. The first time you open a
.gofile, Zed offers to install the Go tools — accept.
Visual Studio Code (most popular, more features) — powerful but can feel overwhelming at first.
- Download: code.visualstudio.com.
- Run the installer and make sure "Add to PATH" is checked.
- Set up Go support:
- Open VS Code and click the Extensions icon (four squares).
- Search for "Go" (by the Go Team at Google) and click Install.
- Press
Ctrl + Shift + P, typeGo: Install/Update Tools, select all boxes, and click OK.
✅ Tools installed. Continue to Your First Program.
Linux (Ubuntu)¶
1. Install Git¶
Git is available in Ubuntu's package repository:
Verify:
2. Install Go¶
Install the latest version directly from the official site.
-
Download the Linux tarball from go.dev/dl:
Note: Replace the filename with the latest version shown on the downloads page (and the version for your computer arch (amd vs. arm)). -
Extract to
/usr/local(this is the standard location): -
Add Go to your PATH. Append the following lines to
Then reload your shell:~/.bashrc(or~/.zshrcif you use Zsh): -
Verify:
3. Editor: Visual Studio Code (VS Code)¶
Do this only if you do not already have a favorite code editor.
-
Install via Snap (simplest method):
Alternatively, download the.debpackage from code.visualstudio.com and install withsudo apt install ./code_*.deb. -
Install the Go extension:
- Click the Extensions icon (four squares) in the left sidebar.
- Search for "Go" and install the one by the Go Team at Google.
- Press
Ctrl + Shift + P, typeGo: Install/Update Tools, select all, and click OK.
✅ Tools installed. Continue to Your First Program.
Your First Program (Hello World)¶
Once Go is installed, let's check that everything works by writing and running a tiny program. If you have never used a command line before, don't worry — every step is spelled out below.
Step 0 — Open a terminal¶
Almost everything in Go is done from a terminal (also called a command line, command prompt, or shell). This is a window where you type commands and press Enter to run them, instead of clicking buttons. Open it like this:
- Windows: the easiest option is the Git Bash terminal that was installed
together with Git. Click the Start menu, type
Git Bash, and press Enter. (You can also use the built-in Command Prompt: pressWin + R, typecmd, and press Enter — but the commands below assume Git Bash.) - macOS: press
Cmd + Space, typeTerminal, and press Enter. - Linux (Ubuntu): press
Ctrl + Alt + T, or search for Terminal in the applications menu.
A new window opens with a blinking cursor, ready for you to type. From here on, each time you see a command in a grey box, type it into this terminal and press Enter.
Tip: If you want to understand what is going on when you interact with your computer from a terminal, I recommend that you read https://linuxcommand.org/lc3_learning_the_shell.php
Step 1 — Create a project folder¶
A Go program lives in its own folder. The commands below create a folder called
hello, move into it, and tell Go that this folder is a module (a self-
contained project):
mkdir hello— make a new directory (folder) namedhello.cd hello— change directory: step inside the folder you just made. Every command you type from now on runs inside this folder.go mod init hello— set up the folder as a Go project.
Where did the folder go? It is created inside whatever folder the terminal is currently "in" — usually your home folder (e.g.
C:\Users\YourNameon Windows, or/home/yournameon Linux). That is fine for now.
Step 2 — Create the program file¶
Now create a text file named main.go inside the hello folder, using your
editor (VS Code, Zed, Notepad++, …). Open the editor, create a new file,
paste the lines below, and save it as main.go inside the hello folder:
Make sure the file is named exactly
main.go(notmain.go.txt). In Notepad++ or VS Code, choose Save As and type the full namemain.go.
Step 3 — Run the program¶
Back in the terminal (still inside the hello folder), type:
The . means "run the program in the current folder". You should see this line
printed in the terminal:
🎉 Congratulations — your Go environment is fully working, and you have just written and run your first program.
(Optional) Install an AI Coding Agent¶
An AI Coding agent runs inside your terminal. You describe what you want in plain English, and it reads your files, writes code, runs commands, and explains what it is doing. It is entirely optional, but many people find it a helpful companion when learning Go or working with this project.
There exists several AI coding agents. Here I describe Claude Code. Instructions for installation are available at https://code.claude.com/docs/en/quickstart
You will need an account. Claude Code requires either a Claude subscription (Pro or Max) or an Anthropic API account with billing set up. The first time you run it, it walks you through signing in.
First run¶
You may need to close and reopen your terminal after installing so that the
claudecommand becomes available.
- In your terminal, move into a project folder (for example the
hellofolder you created above, or your copy of this repository): - Start Claude Code:
- The first time, it asks you to log in — follow the on-screen instructions to sign in with your Claude or Anthropic account.
- Once you see the prompt, just type a request in plain English and press Enter, for example:
To leave Claude Code, type /exit (or press Ctrl + C twice).
Verify the install at any time with: