Go can be installed on all the three platforms Mac, Windows, and Linux. You can download the binary for the corresponding platform from its official website.
Apple Mac OS
- Download the Mac OS installer from its official website.
- Double click to start the installation.
- Follow the prompts and this will have Golang installed in /usr/local/go and would have also added the folder /usr/local/go/bin to your PATH environment variable.
- Download the MSI installer from its official website.
- Double click to start the installation and follow the prompts.
- This will install Go in location C:\Go and will also add the directory C:\Go\bin to your path environment variable.
- Download the tar file from its official website.
- Unzip it to /usr/local.
- Add /usr/local/go/bin to the PATH environment variable. This will install Go in Linux.
$ sudo tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz $ export PATH=$PATH:/usr/local/go/bin
Changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as
$ source $HOME/.profile
Verifying the Installation
To verify that Go installed successfully, type the command go version in the terminal and it will output the installed Go version. Here is the output in my terminal.
$ go version go version go1.15.6 linux/amd64
1.15.6 was the latest version of Go when writing this tutorial. This confirms that Go has been installed successfully.