How to uninstall Golang in 3 easy steps via terminal

Have you tried removing the $PATH export on .bash_profile or .bashrc file but Go is still running?

To remove Golang from your machine you must run 2 commands in your terminal, which go and rm the file the path the first command prompted on the screen.

Step 1: Find out where the Golang binary is located in your machine

To find out where the Go binary is located run the following command on your terminal:


which go

You may get an out like this:


/usr/local/go/bin/go

# OR

/usr/bin/go

Whatever the output is of which go, copy the output onto your clipboard.

Step 2: Remove the Golang binary

Once you’ve copied the path to the Go binary run the rm command to remove it. You may have to run sudo as well.


sudo rm -rvf /usr/local/go/

Step 3: Remove any reference from your .bashrc file

You may have $GOPATH or $PATH export definitions in your .bash_profile or .bashrc file. Go ahead and remove those.

That’s it you’re done!

I like to tweet about Golang and post helpful code snippets. Follow me there if you would like some too!