Install Go on your local machine¶
Installing on Mac OSx:¶
Installing on Mac OSx
Installing Go on your mac is pretty straight forward, choose any one method: -
A) Installing using package installer directly from golang.org
B) Using Homebrew
A) Installing using the package installer
Package installer method is the simplest way to get you started, just download the .pkg file by clicking on this link and install it just as you would install any other program on your mac.
The installer will automatically create everything for you including setting up your environment variables.
Installer will automatically install it to
After installing read "Checking the installation" section below to make sure everything works.
B) Using Homebrew
Before using this method, make sure you have homebrew installed, if it is not installed checkout this link and install it.
Open your terminal and type the following:
brew will automatically fetch the latest binaries and install it for you, make sure they are installed to
Its now time to setup your environment variables, check the "Setting up environment variables" to complete the installation and start using Go.
Installing on FreeBSD & Linux:¶
Installing on FreeBSD & Linux
Download the archive from golang.org and extract it to usr/local, for extracting open the terminal in the downloaded directory and type the following:
If you have downloaded Go v 1.10.3 type the following command, if you have downloaded some other version, change the version in the following command.
Open terminal in downloaded directory and type:
After extracting set up GOPATH, refer the "Setting up environment variables" section.
Installing on Windows:¶
Installing on Windows
Download the msi installer from golang.org and follow the prompts to intsall it.
By default it is installed in
all the environmental variables are set automatically by the installer.
If you are using windows, I would highly recommend to install Git & Git Bash.
Setting up environment variables:¶
Setting up environment variables
If you have installed Go using brew on OSx or on linux you need to set up GOPATH.
A) If you are using bash, open and edit:
B) If you are using zsh, open and edit:
and add the following:
1 2 3 4
save the file and restart the terminal or type
A) For bash:
B) For zsh:
Editing .bash_profile or .zshrc
Follow the instructions to edit .bash_profile or .zshrc, open the terminal and type
If you are using atom type
Checking the installation:¶
Checking the installation
Open the terminal and type:
it should give the output:
For windows it should give output:
You can also test using the following commands: