Go installation steps

Go (Golang) – Installation Steps

Below are simple, step-by-step Go installation instructions for all major operating systems.


1️⃣ Install Go on Windows

Step 1: Download Go

Step 2: Run Installer

  • Double-click the downloaded .msi file

  • Click Next → Install

  • Default path:

    C:\Program Files\Go\

Step 3: Verify Installation

Open Command Prompt and run:

go version

✅ Output example:

go version go1.22.5 windows/amd64

2️⃣ Install Go on Linux (Ubuntu/Debian)

Step 1: Download Go

wget https://go.dev/dl/go1.22.5.linux-amd64.tar.gz

Step 2: Extract Files

sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.22.5.linux-amd64.tar.gz

Step 3: Set Environment Variables

Add this to ~/.bashrc or ~/.profile:

export PATH=$PATH:/usr/local/go/bin

Apply changes:

source ~/.bashrc

Step 4: Verify

go version

3️⃣ Install Go on macOS

Method 1: Using Installer (Easy)

  1. Download .pkg from 👉 https://go.dev/dl/

  2. Run installer

  3. Follow on-screen instructions

Verify:

go version

Method 2: Using Homebrew

brew install go

Verify:

go version

4️⃣ Set Up Go Workspace (Recommended)

Step 1: Create Project Folder

mkdir go-projects
cd go-projects

Step 2: Initialize Module

go mod init myapp

5️⃣ Run Your First Go Program

Create main.go:

package main

import "fmt"

func main() {
fmt.Println("Hello, Go!")
}

Run:

go run main.go

Build executable:

go build

6️⃣ Important Go Commands

Command Description
go version Check Go version
go run Run program
go build Compile program
go mod init Initialize module
go get Download packages

You may also like...