How to Install Golang on Different Platforms
Daniel Hayes
Full-Stack Engineer · Leapcell
Installing Go (Golang) enables you to develop efficient and reliable software across various platforms. Below are step-by-step instructions for installing Go on Windows, macOS, and Linux systems.
Key Takeaways
- Go installation requires downloading and configuring environment variables for Windows, macOS, and Linux.
- Verification of installation is essential to ensure Go is correctly set up using
go version
. - Each OS has a distinct installation method, but all involve setting the
PATH
variable for proper execution.
1. Installing Go on Windows
Step 1: Download the Installer
- Visit the official Go download page: https://go.dev/dl/
- Click on the Windows installer (
.msi
file) to download it.
Step 2: Run the Installer
- Locate the downloaded
.msi
file and double-click to run it. - Follow the on-screen instructions to complete the installation. The default installation path is
C:\Go
.
Step 3: Set Up Environment Variables
- Open the Start menu, search for "Environment Variables," and select "Edit the system environment variables."
- In the System Properties window, click on "Environment Variables."
- Under "System variables," select the
Path
variable and click "Edit." - Cick "New" and add
C:\Go\bin
. - Click "OK" to save and exit.
Step 4: Verify the Installation
- Open Command Prompt and type:
go version
- You should see the installed Go version displayed.
2. Installing Go on macOS
Step 1: Download the Installer
- Navigate to the official Go download page: https://go.dev/dl/
- Download the macOS package installer (
.pkg
file).
Step 2: Run the Installer
- Open the downloaded
.pkg
file and follow the prompts to install Go. The default installation path is/usr/local/go
.
Step 3: Set Up Environment Variables
- Open Terminal.
- Add Go's binary directory to your
PATH
by appending the following line to your shell profile file (e.g.,~/.bash_profile
or~/.zshrc
):
export PATH=$PATH:/usr/local/go/bin
-
Save the file and run:
source ~/.bash_profile
or
source ~/.zshrc
Step 4: Verify the Installation
- In Terminal, type:
go version
- The installed Go version should be displayed.
3. Installing Go on Linux
Step 1: Download the Tarball
- Visit the official Go download page: https://go.dev/dl/
- Download the appropriate tarball for your Linux distribution.
Step 2: Extract and Install
- Open Terminal and navigate to the directory where the tarball was downloaded.
- Remove any previous Go installation:
sudo rm -rf /usr/local/go
- Extract the tarball to
/usr/local
:
sudo tar -C /usr/local -xzf go1.xx.linux-amd64.tar.gz
Replace go1.xx.linux-amd64.tar.gz
with the actual filename.
Step 3: Set Up Environment Variables
- Add Go's binary directory to your
PATH
. Append the following line to your shell profile file (e.g.,~/.bashrc
or~/.zshrc
):
export PATH=$PATH:/usr/local/go/bin
-
Save the file and run:
source ~/.bashrc
or
source ~/.zshrc
Step 4: Verify the Installation
- In Terminal, type:
go version
- The installed Go version should be displayed.
FAQs
The official source is https://go.dev/dl/.
Run go version
in the terminal or command prompt to verify the installation.
It ensures that the system recognizes Go commands globally.
Conclusion
By following these steps, you will have Go installed on your system, ready for development. For more detailed instructions and troubleshooting, refer to the official Go installation guide: https://go.dev/doc/install
We are Leapcell, your top choice for hosting Go projects.
Leapcell is the Next-Gen Serverless Platform for Web Hosting, Async Tasks, and Redis:
Multi-Language Support
- Develop with Node.js, Python, Go, or Rust.
Deploy unlimited projects for free
- pay only for usage — no requests, no charges.
Unbeatable Cost Efficiency
- Pay-as-you-go with no idle charges.
- Example: $25 supports 6.94M requests at a 60ms average response time.
Streamlined Developer Experience
- Intuitive UI for effortless setup.
- Fully automated CI/CD pipelines and GitOps integration.
- Real-time metrics and logging for actionable insights.
Effortless Scalability and High Performance
- Auto-scaling to handle high concurrency with ease.
- Zero operational overhead — just focus on building.
Explore more in the Documentation!
Follow us on X: @LeapcellHQ