How to install Go on Windows, Linux and MacOS

This post will show how to install Go on Windows, Linux, and MacOS. Before installing Go, It's essential to know what GoLang is. Go is an open-source, compiled, high-level, and statically typed programming language. It is also known as GoLang. It was designed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It was developed to improve programming productivity in the era of multicore, networked machines, and large codebases. Go is widely used in production at Google and in many other organizations and open-source projects. For more details about GoLang refer to this article Introduction to Go Programming Language

Let's discuss how to install Go on Windows, Linux, and macOS

How to Install Go on Windows:

To install Go on a Windows system, follow these steps:
    1. Go to the official GoLang website's download page: https://golang.org/dl/. Download the Windows installer that matches your system architecture (either 32-bit or 64-bit).
    2. Once the installer is downloaded, double-click on it to run it. The installer will guide you through the installation process.
    3. How to install Go on Windows, Linux and MacOS
    4. Click on the next and You will be asked to choose the installation location. The default location is fine but you can choose according to your preference. 
    5. How to install Go on Windows, Linux and MacOS
    6. After making your selections, click on next and then click the "Install" button to start the installation.
    7. How to install Go on Windows, Linux and MacOS
    8. Once the installation is complete, you can verify whether Go has been installed successfully or not. Open a command prompt (CMD) or PowerShell window and type: "go version". If the Go is installed successfully, You will get a displayed Go version on the CMD screen.
    How to install Go on Windows, Linux and MacOS


    How to install Go on Linux

    To install Go on a Linux system, follow these steps:
    1. Go to the official GoLang website's download page: https://golang.org/dl/. Download the tar file.
    2. Once the tar file is downloaded, remove any previous Go installation by deleting the /usr/local/go folder (if it exists), then extract the archive you just downloaded into /usr/local
    3. 
      $ rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
      
    4. Add /usr/local/go/bin to the PATH environment variable. You can do this by adding the following line to your $HOME/.profile or /etc/profile
    5. 
      export PATH=$PATH:/usr/local/go/bin
      
    6. Save the profile file and then run source .profile to apply the changes in the system.
    7. Now you can check whether Go is installed successfully by using the "go version" command. If the Go is installed successfully, You will get a displayed Go version
    8. 
      source .profile
      
      go version
      go version go1.21.0 windows/amd64
      


    How to install Go on MacOs

    To install Go on a Mac system, follow these steps:
    1. Go to the official Golang website download page https://golang.org/dl/. You will see different options for Golang download for different operating systems. Look at the Mac System version and download it.
    2. Once it is downloaded start the installation process. Follow the on-screen instructions in the installer.
    3. Once the installation is complete, you can check the Go installation using go version command
    
    go version
    go version go1.21.0 windows/amd64
    
    How to install Go on Windows, Linux and MacOS How to install Go on Windows, Linux and MacOS Reviewed by Prashant Srivastava on August 28, 2023 Rating: 5

    No comments:

    Powered by Blogger.