go-tutorial

Install Go on MacOS

You must first download it before proceeding with the installation. All versions of Go for MacOS are available for download at https://golang.org/dl/.

Download golang for your specific system architecture. For the system, we’ve obtained go1.13.1drawin-amd64.pkg.

Step 1: Install the package on your PC after the download is complete:

Step 2: Once the installation procedures have been completed. Using the Golang version command, open a software called Terminal(It is a command-line interface for macOS). As indicated in the figure below, the Golang version information is displayed, indicating that Go was successfully installed on your machine.

We’ll now set up the Go workspace after successfully installing Go on your PC. Go workspace is a folder on your computer that will house all of your Go code.

Step 3: Create a Go folder in documents (or wherever you like on your system) as indicated in the image below:

Step 4: Tell the Go tools where to look for this folder now. To do so, first navigate to your home directory and run the following command:

cd ~

Then use the following command to set the folder’s path:

echo "export GOPATH=/Users/anki/Documents/go" >> .bash_profile

Export GOPATH=/Users/anki/Documents/go is added to the.bash profile file. The.bash profile is a file that loads automatically when you log into your Mac account and contains all of your command-line interface’s startup options and preferences (CLI).

Step 5: Run the following command to see if your.bash profile contains the following path:

cat .bash_profile

Step 6: Now we’ll use the following command to verify our go route. You can also skip this step if you so desire.

echo $GOPATH

RECOMMENDED ARTICLES





Leave a Reply

Your email address will not be published.