If you are also looking to get started with Golang on your Mac OS computer, this blog will help you get through it easily by providing you with all the necessary details about how to install Golang on macOS and all the other information you need to get started with Golang on your Mac computer.

Step 1 – Download Golang

To download the latest Go release visit https://golang.org/dl/. You will see the download link for Apple macOS. The current version of Go 1.19 support macOS 10.10 or later versions with 64-bit support only. Alternatively, you can download Go 1.19 using the curl command line tool.

Step 2 – Install Go on macOS

You have downloaded the Go package on your macOS system. To install it simply double-click on the downloaded file to start the installation wizard. Command-line users can execute the below-mentioned command to begin the installation. An installation wizard will start. Follow the on-screen instruction and complete the installation process.

Step 3 – Setup Go Workspace

Edit the ~/.bash_profile or ~/.profile file (or its equivalent) to set environment variables. Commonly you need to set 3 environment variables as GOROOT, GOPATH and PATH.

Set the GOROOT, which is the location of the Golang installation directory.export GOROOT=/usr/local/go Then set the GOPATH environment variable, which is the location of your work directory. For example my project directory is ~/Projects/Proj1 .export GOPATH=$HOME/Projects/Proj1 Now update the PATH environment variable to access go binary system wide.export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Step 4 – Install Go Dependency Management Tool

The govendor is a tool used for managing the Go application dependencies efficiently. You should consider this for installation on your system. Now, you can easily install and manage go packages for your application.

Step 5 – Check Go Version

Finally, you have successfully installed and configured go language on your system. First, use the following command to check the installed Go version.

Conclusion

In this tutorial, you have learned to install Golang on macOS operating system. Now, you can use any text editor to start development with the Go programming language. You may also like to install Visual Studio Code on your macOS.

How To Install Golang on MacOS   TecAdmin - 16