How to PROPERLY uninstall Golang? [Step-by-Step]

Written by - Tuan Nguyen
Reviewed by - Deepak Prasad

In this tutorial we will cover different methods to properly uninstall go from multiple distributions such as Linux, Windows, Mac etc.


Uninstall Golang on  Linux

Method 1: Remove the go directory

This method has to be used if you are using go from an archive which was download from official repository. Run the following command on your terminal to identify the location of the Go binary, and copy the output to your clipboard:

which go

Run the rm command to remove the Go binary after copying its path. You might also need to run sudo:

sudo rm -rvf /usr/local/go/

Your .bash profile or .bashrc file may contain export definitions for $GOPATH or $PATH ( If you installed Go with the macOS package, remove the /etc/paths.d/go file). The final step is to remove these environment variables.


Method 2: Using apt-get package manager

The apt-get command can be used on Debian based distributions such as Ubuntu. To uninstall golang-go package itself from Ubuntu executes on the terminal:

sudo apt-get remove golang-go

To remove the golang-go package from Ubuntu as well as any other dependent packages that are no longer required:

sudo apt-get autoremove golang-go

This will work if you also want to remove the golang-go configuration and/or data files from Ubuntu:

sudo apt-get purge golang-go

Execute the following command to remove the golang-go and its dependencies from Ubuntu's configuration and/or data files:

sudo apt-get autoremove --purge golang-go


Method-3: Using yum or dnf package manager

On Red Hat based Linux distributions we must use yum or dnf package manager. So uninstall golang package from Red Hat based distributions such as CentOS, Rocky Linux, AlmaLinux you can first check whether golang package is installed

# rpm -qa | grep golang

If available then you can remove them using

# yum -y remove golang golang-src golang-bin


Uninstall Golang on Windows

Go can be easily uninstalled using Add/Remove Programs in the Windows control panel:

1. Go to the Control Panel section, and double-click Add/Remove Programs.

2. In Add/Remove Programs, right-click the go version you want to uninstall (for example Go Programming Language amd64 go1.19.3) then follow the prompts.

3. Click Yes to confirm uninstall Go

How to PROPERLY uninstall Golang? [Step-by-Step]


For removing Go with tools, you can also use the command line:

Uninstall using the command line by running the following command:

msiexec /x go{{version}}.windows-{{cpu-arch}}.msi /q

It should be noted that this method of uninstalling Windows will immediately delete any environment variables set up during the initial installation.


Uninstall Golang on MacOS

If you have used an installer, you can uninstall golang by using the same installer.
If you have installed from source then rm -rf /usr/local/go

rm -rf $(echo $GOPATH)

Then, remove all entries related to go i.e. GOROOT, GOPATH from ~/.bash_profile and run

source ~/.bash_profile

If you installed Go with the macOS package, remove the /etc/paths.d/go file.



After reading this article, you should understand how to remove Go from your personal computers. In the case of upgrading the Go version, we can delete the older and install a newer version or even set up multiple versions in 1 environment.  The Go method for running multiple Go versions is straightforward and elegant because it makes use of standard Go features.



Uninstall go


Views: 101

Tuan Nguyen

He is proficient in Golang, Python, Java, MongoDB, Selenium, Spring Boot, Kubernetes, Scrapy, API development, Docker, Data Scraping, PrimeFaces, Linux, Data Structures, and Data Mining. With expertise spanning these technologies, he develops robust solutions and implements efficient data processing and management strategies across various projects and platforms. You can connect with him on LinkedIn.

Categories GO

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to

Thank You for your support!!

Leave a Comment