How to Uninstall Golang from Windows, macOS, and Linux
James Reed
Infrastructure Engineer · Leapcell

Key Takeaways
- Uninstalling Go requires deleting the main Go installation directory.
- Environment variables like
GOROOT
andGOPATH
should be removed for a clean uninstall. - Shell configuration files may need manual editing to remove Go-related paths.
Go, also known as Golang, is a popular programming language developed by Google. If you no longer need Go on your system or want to perform a clean reinstall, you may need to uninstall it. This guide explains how to completely remove Go from your system, covering Windows, macOS, and Linux.
Uninstalling Go on Windows
-
Open Control Panel
Go to the Start menu, search for Control Panel, and open it. -
Uninstall a Program
Click on “Programs” > “Programs and Features”, then locate Go Programming Language in the list. -
Remove Go
Select it and click Uninstall. Follow the prompts to complete the uninstallation. -
Delete Environment Variables (Optional)
- Press
Win + R
, typesysdm.cpl
, and hit Enter. - Go to the Advanced tab and click Environment Variables.
- Remove any entries related to
GOROOT
orGOPATH
if they exist.
- Press
-
Clean Up Remaining Files
Delete the Go installation directory, usually located at:C:\Go
Uninstalling Go on macOS
-
Remove Go Binary and Files
If you installed Go using the official installer or manually, remove the following:sudo rm -rf /usr/local/go
-
Remove Go Workspace (Optional)
If you set aGOPATH
, delete it as needed. For example:rm -rf ~/go
-
Edit Shell Profile (Optional)
Open your shell profile file (like~/.zshrc
or~/.bash_profile
) and remove any lines like:export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/go
Save the file and reload it:
source ~/.zshrc # or source ~/.bash_profile
Uninstalling Go on Linux
-
Delete Go Installation Directory
If you installed Go manually, it’s typically located at/usr/local/go
. Remove it:sudo rm -rf /usr/local/go
-
Remove Go Workspace (Optional)
If you set a workspace, remove it:rm -rf ~/go
-
Clean Up Shell Configuration
Edit your shell configuration file (like~/.bashrc
or~/.zshrc
) and remove Go-related environment variables. -
Apply Changes
Reload the configuration:source ~/.bashrc
Verifying Go is Uninstalled
After following the above steps, verify that Go has been removed by running:
go version
If Go is uninstalled successfully, you should see a message like command not found
.
Conclusion
Uninstalling Go is a straightforward process, but to completely remove it, you should also clean up environment variables and leftover workspace files. Whether you're switching versions or moving on from Go, these steps ensure a clean removal.
FAQs
No, your projects (typically in ~/go
) are not removed unless you delete them manually.
Run go version
. If Go is removed, you’ll see a “command not found” message.
Run brew uninstall go
and clean up any custom paths in your shell profile.
We are Leapcell, your top choice for hosting Go projects.
Leapcell is the Next-Gen Serverless Platform for Web Hosting, Async Tasks, and Redis:
Multi-Language Support
- Develop with Node.js, Python, Go, or Rust.
Deploy unlimited projects for free
- pay only for usage — no requests, no charges.
Unbeatable Cost Efficiency
- Pay-as-you-go with no idle charges.
- Example: $25 supports 6.94M requests at a 60ms average response time.
Streamlined Developer Experience
- Intuitive UI for effortless setup.
- Fully automated CI/CD pipelines and GitOps integration.
- Real-time metrics and logging for actionable insights.
Effortless Scalability and High Performance
- Auto-scaling to handle high concurrency with ease.
- Zero operational overhead — just focus on building.
Explore more in the Documentation!
Follow us on X: @LeapcellHQ