Install Golang on Mac [Step-by-Step]

Step 1: Checking if Go is installed or not. Before we begin with the installation of Go, it is good to check if it might be already installed on your system. To check if your device is preinstalled with Golang or not, just go to the Terminal and run the command:

$go version

If Golang is already installed, it will generate a message with all the details of the Golang version available as shown below, otherwise, it will give an error.

Step 2: Before starting with the installation process, you need to download it. So for that, all versions of Go for MacOS are available on https://golang.org/dl/

Download the Golang according to your system architecture. Here, we have downloaded go1.13.1drawin-amd64.pkg for the system. Step 3: After downloading process, install the package on your system:

Step 4: After completing the installation processes. Open terminal and check go installed with $go version

Setting up the Go Workspace

After successfully installing Go on your system, now we are going to set up the Go workspace. Go workspace is a folder on your computer where all your go code will going to store.

Step 1: Creating a folder named as Go in documents(or wherever you want in your system) like as shown in the below image:

Step 2: Now tell the Go tools to where to find this folder. So for that first of all, you go to your home directory using the following command:

$echo “export GOPATH=/Users/creampxxz/Documents/go” >> .bash_profile

Leave a Reply

Your email address will not be published. Required fields are marked *