How to Install Go on Linux, macOS, and Windows: A Friendly Guide

How to Install Go on Linux, macOS, and Windows: A Friendly Guide

If you’re excited to start coding in Go (Golang), you’re in the right place! In this easy-to-follow guide, I’ll help you install Go on Linux, macOS, and Windows. Before we jump…


This content originally appeared on DEV Community and was authored by Aditya Rawas

How to Install Go on Linux, macOS, and Windows: A Friendly Guide

If you're excited to start coding in Go (Golang), you’re in the right place! In this easy-to-follow guide, I’ll help you install Go on Linux, macOS, and Windows. Before we jump into the installation process, head over to the official Go website and grab the version compatible with your operating system:

👉 Download Go

Once you've got the Go installer downloaded, follow the steps below to get everything set up!

Installing Go on Linux

  1. Remove any previous Go installations If you've already installed Go before, it’s best to start fresh by deleting the old version. Run the command below to remove the previous installation:
   $ sudo rm -rf /usr/local/go

Now, extract the archive you just downloaded into /usr/local:

   $ sudo tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz

Pro Tip: Make sure you’re using sudo for these commands to have the necessary permissions.

  1. Avoid broken installations

    Don’t extract the new Go archive into an existing /usr/local/go folder. This can cause issues, so starting fresh is always best.

  2. Update your PATH

    To use Go commands easily, add Go's bin directory to your PATH. Open your $HOME/.profile (or /etc/profile for system-wide installs) and add this line:

   export PATH=$PATH:/usr/local/go/bin

Quick Tip: You can immediately apply the changes by running:

   source $HOME/.profile
  1. Verify the installation To check if Go is installed correctly, type:
   $ go version

You should see something like go version go1.23.1 linux/amd64. Success!

Installing Go on macOS

  1. Install Go

    After downloading the Go installer from the link above, open the package file and follow the prompts. Go will automatically install to /usr/local/go.

  2. Check your PATH

    During installation, Go usually adds /usr/local/go/bin to your PATH automatically. If not, you can add it manually by editing your ~/.zshrc or ~/.bash_profile:

   export PATH=$PATH:/usr/local/go/bin
  1. Restart terminal sessions After installation, close and reopen your terminal for the changes to take effect. Alternatively, use:
   source ~/.zshrc
  1. Verify your installation Run the following command in the terminal to confirm Go is installed properly:
   $ go version

If you see the installed version, you’re good to go!

Installing Go on Windows

  1. Install Go

    After downloading the MSI installer for Windows, open it and follow the steps. By default, Go installs to C:\Program Files\Go.

  2. Environment Setup

    The installer will automatically add Go to your PATH. After the installation, close and reopen any open Command Prompt windows to apply the changes.

  3. Verify the installation

    Open Command Prompt (search for “cmd” in the Start menu) and type:

   $ go version

You should see something like go version go1.23.1 windows/amd64. That’s it!

Great! Here's how you can wrap up your blog:

Wrapping Up

And there you have it! Whether you’re on Linux, macOS, or Windows, installing Go is straightforward. Now that Go is up and running, you can start building some amazing projects!

If you have any questions or run into any issues, feel free to drop a comment below! I’m here to help. Happy coding! 🎉

Want to read more such blogs? Visit www.adityarawas.in for more tutorials, tips, and insights!


This content originally appeared on DEV Community and was authored by Aditya Rawas


Print Share Comment Cite Upload Translate Updates
APA

Aditya Rawas | Sciencx (2024-09-27T03:31:56+00:00) How to Install Go on Linux, macOS, and Windows: A Friendly Guide. Retrieved from https://www.scien.cx/2024/09/27/how-to-install-go-on-linux-macos-and-windows-a-friendly-guide/

MLA
" » How to Install Go on Linux, macOS, and Windows: A Friendly Guide." Aditya Rawas | Sciencx - Friday September 27, 2024, https://www.scien.cx/2024/09/27/how-to-install-go-on-linux-macos-and-windows-a-friendly-guide/
HARVARD
Aditya Rawas | Sciencx Friday September 27, 2024 » How to Install Go on Linux, macOS, and Windows: A Friendly Guide., viewed ,<https://www.scien.cx/2024/09/27/how-to-install-go-on-linux-macos-and-windows-a-friendly-guide/>
VANCOUVER
Aditya Rawas | Sciencx - » How to Install Go on Linux, macOS, and Windows: A Friendly Guide. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/27/how-to-install-go-on-linux-macos-and-windows-a-friendly-guide/
CHICAGO
" » How to Install Go on Linux, macOS, and Windows: A Friendly Guide." Aditya Rawas | Sciencx - Accessed . https://www.scien.cx/2024/09/27/how-to-install-go-on-linux-macos-and-windows-a-friendly-guide/
IEEE
" » How to Install Go on Linux, macOS, and Windows: A Friendly Guide." Aditya Rawas | Sciencx [Online]. Available: https://www.scien.cx/2024/09/27/how-to-install-go-on-linux-macos-and-windows-a-friendly-guide/. [Accessed: ]
rf:citation
» How to Install Go on Linux, macOS, and Windows: A Friendly Guide | Aditya Rawas | Sciencx | https://www.scien.cx/2024/09/27/how-to-install-go-on-linux-macos-and-windows-a-friendly-guide/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.