Install Latest Version of Go (Linux/OSX)

This article describes how to install the latest version of Go (golang). It also helpfully updates itself by pulling the latest version numbers directly, so you don’t have to go and dig out the latest version each time they release a version (yay!) - just copy and paste away. For more info, try their installer docs.

Ubuntu/Linux

Step 1) Download

1
wget https://dl.google.com/go/GOVERSION.linux-amd64.tar.gz

Step 2) Extract & Install

1
sudo tar -C /usr/local -xvf GOVERSION.linux-amd64.tar.gz

Step 3) Add Path to file (if you are installing for the first time)

1
echo "export PATH=\$PATH:/usr/local/go/bin" >> $HOME/.profile
1
source ~/.profile

Step 4) Test

1
go version

If you’re trying to update your go version instead of installing it, you can clear your existing version by calling: sudo rm -rvf /usr/local/go/.

OSX

Download the latest installer at:

1
https://go.dev/dl/GOVERSION.darwin-amd64.pkg
Download Package

 

Easy! (hopefully) Let us know in comments below if you hit any issues.