Golang, also known as Go, is a statically typed, compiled language designed with simplicity and performance in mind. If you're developing on macOS, you'll need to install Golang to take advantage of its speed and efficiency for your projects. In this article, we will walk you through the steps to install Golang on macOS in 2025.
Follow these steps for a smooth installation process and ensure you're ready to start developing in Golang!
Step 1: Update Your System
Before installing any new software, it's a good practice to ensure your system is up to date. Open your Terminal and run the following command to download and install the latest macOS updates:
softwareupdate --install --all
Step 2: Download Golang
Visit the official Golang download page to get the latest version compatible with macOS. As of 2025, you should download the .pkg
installer for macOS.
Step 3: Install Golang
- Locate the downloaded
.pkg
file in yourDownloads
folder. - Double-click the
.pkg
file to open the Installer. - Follow the on-screen instructions to complete the installation. By default, Golang will be installed in
/usr/local/go
.
Step 4: Set Up Your Go Environment
After installation, you'll need to set up your Go environment. Add the Go binary to your system's PATH for convenient access:
- Open your Terminal.
- Edit your shell profile file (.zshrc, .bash_profile, or .bashrc, depending on your shell).
- Add the following lines to the file:
export PATH=$PATH:/usr/local/go/bin
- Save the file and apply the changes by running:
source ~/.zshrc # or ~/.bash_profile or ~/.bashrc
Step 5: Verify the Installation
To confirm that Golang has been installed correctly, run the following command in your Terminal:
go version
This command should return the installed version of Golang, indicating that the installation was successful.
Step 6: Test Your Go Installation
Create a simple Go program to test the setup:
- Create a new directory for your Go workspace, and navigate into it:
mkdir ~/go-workspace
cd ~/go-workspace
- Create a new Go file named
hello.go
:
touch hello.go
- Open
hello.go
in your preferred text editor and add the following code:
package main
import "fmt"
func main() {
fmt.Println("Hello, Go!")
}
- Save the file and execute it using:
go run hello.go
You should see "Hello, Go!" printed in your Terminal, indicating that your Go installation is working correctly.
Conclusion
Following these steps, you should be able to install Golang on your macOS in 2025 successfully. Whether you're building web applications or developing system-level software, Golang provides the performance and simplicity developers need.
If you're interested in installing Golang on other platforms, check out these resources:
- Linux Golang Installation Guide
- Golang Installation Guide for macOS
- Another macOS Golang Installation Resource
- Golang Installation on Windows
- Another Golang Installation Resource for Windows
By following these links, you can ensure seamless Golang installations on various operating systems.
Top comments (0)