Before you install Go, you might worry that the setup will be hard. It is not. Today you will set it up and run your first program in about 15 minutes. This is Day 1 of my daily Go series, from basics to advanced.
If you are new here, first read my simple guide on what Go is and why developers use it. Also, keep my Go interview questions and answers page handy for later.
Why You Need to Install Go First
Go is a compiled language. This means a tool called the compiler turns your code into a program your computer can run. That is why you must install Go before you write any code. It is like cooking: you can read a recipe anytime, but you need a stove.
The Go download gives you everything in one package. For example, it includes the compiler, the standard library and the go command. You will use the go command every day to run, build and test your code.
What You Need Before You Install Go
You only need a few things to install Go and start coding.
- A computer with Windows 10 or later, macOS 13 or later, or Linux.
- Admin rights, so the installer can add files to your system.
- A terminal: Command Prompt or PowerShell on Windows, and Terminal on macOS or Linux.
- A code editor. I use VS Code with the official Go extension, but any editor works.
You should also know your processor type. Most Windows and Linux laptops use an Intel or AMD chip, which Go calls amd64. However, newer Macs use Apple chips, which Go calls arm64.
How to Install Go on Your Computer
First, open the official Go download page. At the time of writing, the latest stable version is Go 1.27.1. Then pick the file that matches your system from the table below.
| Your system | File to download | Where Go goes |
|---|---|---|
| Windows (Intel or AMD) | go1.27.1.windows-amd64.msi | C:\Program Files\Go |
| macOS (Apple chip) | go1.27.1.darwin-arm64.pkg | /usr/local/go |
| macOS (Intel chip) | go1.27.1.darwin-amd64.pkg | /usr/local/go |
| Linux (Intel or AMD) | go1.27.1.linux-amd64.tar.gz | /usr/local/go |
Go releases a new version about every six months. So your number may be higher, but the steps stay the same.

The full journey in this post: download, install, check the version, create a module, write main.go and run it.
Install Go on Windows
- Download the .msi file for Windows.
- Double-click it and click Next on each screen. The installer puts Go in C:\Program Files\Go.
- Click Finish. The installer also adds Go to your PATH.
- Close every open terminal window, then open a new one.
PATH is a list of folders where your computer looks for commands. Old terminal windows do not see the new PATH, so always open a fresh one.
Install Go on macOS
Download the .pkg file and open it. Next, follow the installer screens. The package puts Go in /usr/local/go and adds /usr/local/go/bin to your PATH. Finally, quit Terminal fully and open it again.
Install Go on Linux
To install Go on Linux, you unpack a .tar.gz file yourself. First, go to the folder where you saved the download, then run these three lines.
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.27.1.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
source ~/.profile
The first line removes any old Go folder and unpacks the new one. Be careful with rm -rf, because it deletes without asking. The second line adds Go to your PATH for every new session. Then the third line loads that change right now, so you do not need to log out.
Check That Go Works
Now type this command in your terminal and press Enter.
go version
If everything went well, you will see a line like this one.
go version go1.27.1 windows/amd64
The last part shows your system, so a Mac user may see darwin/arm64 instead. In short, any version number here means the setup worked. If you see an error, check the problems table below.
Write Your First Go Program
With Go ready, it is time to write real code. We will make a tiny program that prints a message.
Create a Project Folder and a Module
mkdir hello
cd hello
go mod init example/hello
The first two commands make a folder and move into it. Then go mod init creates a file called go.mod. A module is simply a Go project with a name. The go.mod file stores that name and the Go version your project needs.
Later, real projects often use a GitHub path, such as github.com/yourname/hello.
Write the Code
Next, create a file named main.go inside the hello folder. Then paste this code into it and save.
package main
import "fmt"
func main() {
fmt.Println("Hello, Go!")
}
Every line has a job, so here is what each one does.
| Line | What it means |
|---|---|
| package main | Tells Go this file builds a program you can run, not a library. |
| import “fmt” | Loads the fmt package, which prints text on the screen. |
| func main() | The starting point. Go runs this function first. |
| fmt.Println(…) | Prints the message and moves to a new line. |
Also, look at the curly brace after func main(). In Go, it must stay on the same line. If you move it down, the code will not compile.
Run and Build the Program
Now run the program from inside the hello folder.
go run .
Hello, Go!
The dot means the current folder. So go run compiles your code and runs it in one step. However, it does not leave a program file behind.
To get a real program file, use go build instead. It creates a file named hello on macOS and Linux, or hello.exe on Windows. You can copy that file to another machine with the same system, and it runs without Go installed.
Common Problems After You Install Go
| Message you see | Why it happens | How to fix it |
|---|---|---|
| ‘go’ is not recognized, or go: command not found | Your terminal cannot find Go on the PATH. | Close all terminals and open a new one. On Linux, check your ~/.profile line. |
| go: cannot find main module | There is no go.mod file in your folder. | Move into your project folder, then run go mod init. |
| go version shows an old number | An older Go copy sits earlier on your PATH. | Remove the old Go, then open a new terminal. |
Most of these issues come from PATH. So when something feels wrong, open a new terminal first.
Official Resources
These pages come from the Go team, so they always stay up to date.
Quick Recap
- You can install Go from go.dev/dl on Windows, macOS or Linux in a few minutes.
- The go version command tells you if your setup works.
- The go mod init command creates a module, which is a Go project with a name.
- go run . runs your code, while go build makes a program file you can share.
- Most setup errors come from PATH, so open a fresh terminal first.
What’s Next?
Now Go is on your computer and your first program runs. Next, we will learn how Go stores data.
Coming soon: Go Variables, Constants and Data Types
Later in this series, we will also connect Go to a real database. If you want a head start, my database interview questions post covers the basics.


