If you’re looking to get started with Golang on your macOS in 2025, you’re in the right place! This guide will walk you through the steps necessary to set up Golang, ensuring you have everything you need to begin coding efficiently. Golang, developed by Google, is a statically typed, compiled language known for its simplicity and performance. Let’s dive into the setup process on macOS.
Before installing Golang, ensure your macOS is compatible. As of 2025, Golang requires macOS version 10.15 or later. Ensure your system is up-to-date to avoid any compatibility issues.
Visit the official Golang website at golang.org to download the latest version for macOS. Make sure to choose the .pkg
file, which is tailored for macOS installations.
Once downloaded, open the .pkg
file and follow the on-screen instructions to install Golang. The installer will guide you through the necessary steps and confirm a successful installation.
For Golang to function correctly, you need to configure your environment variables. Open your terminal and edit your .bash_profile
or .zshrc
file (depending on your shell) with the following command:
nano ~/.zshrc
Add these lines to set your GOPATH
and update your PATH
:
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Remember to reload your shell for the changes to take effect:
source ~/.zshrc
To verify that Golang is installed correctly, open a terminal and type:
go version
This command should display the current Golang version, confirming that the installation was successful.
To ensure everything is set up correctly, create a new directory for your Go projects:
mkdir ~/go-projects
cd ~/go-projects
Create a simple Go file:
nano hello.go
Add the following code:
package main
import "fmt"
func main() {
fmt.Println("Hello, Go!")
}
Run your program using:
go run hello.go
If you see “Hello, Go!” printed in your terminal, congratulations! You’ve successfully set up Golang on macOS.
By following these steps, you’re now ready to explore Golang’s rich ecosystem and start building powerful applications. Good luck with your Golang journey!