Install Go with a package manager
If you want a manual solution instead for more control and to get the latest release available, see this gist.
Install the Go binary.
- Debian/Ubuntu
- Install with
apt-get
to/usr/bin/go
. NB. Requires root privileges.$ sudo apt-get update $ sudo apt-get install golang-go
- Install with
- macOS
- Install with Brew.
$ brew install go
- Install with Brew.
Set up Go packages.
- Your user-level packages installed to Go bin (
~/go/bin
) must be available to execute. So add this to your profile config (.bash_profile
or.profile
).export PATH="$HOME/go/bin:$PATH"
Test your installation:
- Version.
$ go version
go version go1.15.2 darwin/amd64
- Check environment variables.
$ go env
GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/mcurrin/Library/Caches/go-build" GOENV="/Users/mcurrin/Library/Application Support/go/env" ...
For more info, see Install guide in the Go docs.