programming

How to Install Golang on Windows, Macbook and Linux Computers

First download the Golang library on the [Golang] website (https://golang.org/doc/install).

MAC

  • Select the package and download according to MacOS support. If you use a Macbook M1, you should install the ARM64 version.
  • After downloading the file with the .dmg extension, install it as you usually install applications. Once finished, usually the Golang path will be saved in the /usr/local/go folder
  • If necessary, type the command below to set the local environment
    export PATH=$PATH:/usr/local/go/bin
    

Windows

  • Select the package and download it according to the supported version of Windows.
  • After downloading the file with the .exe extension, install it like installing any other application. Usually files will be saved in the Program Files or Program Files (x86) folder
  • Open terminal or cmd.

Linux

  • Select the package and download it according to the supported Linux version
  • carry out the command below
    rm -rf /usr/local/go && tar -C /usr/local -xzf go{version-go}.linux-amd64.tar.gz
    
  • Make sure the environment path has been set so that the go library supports the operating system. This can be done with the command below.
    export PATH=$PATH:/usr/local/go/bin
    

Verify

After carrying out the installation process above, we can check whether Golang has been installed on our computer or not

  • Open terminal
  • then type the command go version, then if it has been installed information will appear like this
    go version go1.17.5 darwin/arm64
    
  • or if you know more about the syntax in more detail, you can use go help.
comments powered by Disqus