Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»MacOS»How To Install Golang on MacOS

    How To Install Golang on MacOS

    By RahulAugust 23, 20223 Mins Read

    Go is a compiled programming language developed by Google in 2009. It has gained popularity in the software development industry due to its performance, readability, and simplicity. Go is a general-purpose programming language that feels natural with code snippets that can be written in fewer lines of code than other languages like C or Java. Golang programming has become one of the most popular choices for software developers across the world.

    Advertisement

    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.

    curl -o golang.pkg https://dl.google.com/go/go1.19.darwin-amd64.pkg 
    

    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.

    sudo open golang.pkg 
    

    An installation wizard will start. Follow the on-screen instruction and complete the installation process.

    How to Install Go on macos

    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.

    go get -u github.com/kardianos/govendor 
    

    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.

    go version 
    
    go version go1.19 darwin/amd64
    

    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.

    Go Golang macOS
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Install Postgres on MacOS

    How To Install PostgreSQL on MacOS

    How to Change Terminal Font Size in macOS

    How to Install LibreOffice on Mac

    How to Install LibreOffice on macOS

    View 1 Comment

    1 Comment

    1. Oleelu on October 30, 2019 5:31 pm

      Thank you sir!

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.