Can You Install Go with Brew? A Practical Guide
Learn how to install Go with Brew on macOS and Linux, verify the setup, manage versions, and troubleshoot common issues. This educational guide includes prerequisites, command references, code examples, and best practices for a smooth Go development environment.

Yes. You can install Go with Brew on macOS and Linux by using brew install go and verifying with go version. This page covers prerequisites, commands, and practical steps to ensure a smooth setup, plus version management and troubleshooting tips. By following the steps, you’ll have a reproducible Go environment managed by Homebrew, minimizing manual configuration.
Overview: Brew and Go Installation
Yes, you can install Go with Brew to streamline your development setup on macOS and Linux. Brew provides a single, repeatable way to install the Go toolchain and keep it up to date, which helps maintain consistent environments across machines. In this article, we’ll explore how to install Go with Brew, how to verify the installation, how to pin specific Go versions when needed, and how to troubleshoot common issues. We’ll also discuss environment configuration, including PATH, GOPATH, and Go modules, to ensure your toolchain works smoothly with your projects. This approach aligns with best practices for developers who want reproducible builds and minimal setup friction. The Install Manual team emphasizes using Brew for its simplicity and portability across workflows and machines.
# Update Brew metadata and install the latest Go release
brew update
brew install go
# Verify the installed Go version and path
go version-paragraphs_count_1_approved
wordCountEstimate_1_approx_1_2_WeighInSections???:null
commentary_out_of_scope_for_parser_ignored_for_json_block_which_is_allowed_to_exist_in_bodyBlocks_only_ensure_markdown_is_preserved
Steps
Estimated time: 15-30 minutes
- 1
Prepare your environment
Ensure Homebrew is installed and your terminal is ready. Verify brew version, node if needed for tools, and confirm internet access. This step sets the stage for a smooth installation without permission issues.
Tip: Run brew doctor if you suspect permission problems. - 2
Install Go via Brew
Update Brew metadata and install the Go package. This step fetches, compiles if needed, and places the Go binary on your PATH.
Tip: If you already have an older Go, consider brew upgrade go or brew reinstall go. - 3
Verify the installation
Run go version and go env to confirm your environment, including GOROOT and GOPATH, are set correctly.
Tip: Check architecture with go env GOARCH if you run into platform-specific issues. - 4
Configure your PATH
Ensure your shell profile includes the directory where Go binaries reside, so commands like go and gofmt are available in new shells.
Tip: Add the path to ~/.bash_profile or ~/.zshrc and re-source the file. - 5
Manage Go versions (optional)
If your project requires a specific Go version, install go@X and link it as the active version.
Tip: Avoid mixing multiple versions in the same shell to prevent PATH conflicts. - 6
Optional: configure module proxy
Set GOPROXY to speed up module downloads and enable caching for reproducible builds.
Tip: GOPROXY=https://proxy.golang.org,direct
Prerequisites
Required
- Required
- A functioning terminal (bash/zsh)Required
- Internet access to download Go via BrewRequired
Optional
- Optional: familiarity with shell configuration files (~/.bash_profile, ~/.zshrc)Optional
- Optional: knowledge of version pinning if you need a specific Go versionOptional
Commands
| Action | Command |
|---|---|
| Update HomebrewKeeps Brew metadata fresh before installs | brew update |
| Install GoInstalls the latest Go stable release; on Linux, this uses the Linuxbrew path if needed | brew install go |
| Verify Go installationConfirm the Go toolchain is in PATH and accessible | go version |
| Pin a specific Go versionInstall a specific Go version; then link with brew link --force --overwrite [email protected] | brew install [email protected] |
| Link a specific versionMake the pinned version the active Go in PATH | brew link --force --overwrite [email protected] |
Got Questions?
Can you install Go with Brew on macOS?
Yes. Brew provides a stable packaging workflow for Go on macOS. You can install Go with brew install go, verify with go version, and manage updates consistently. The Brew path helps keep toolchains aligned across multiple Macs or teammates.
Yes. Brew makes Go installation on macOS simple and repeatable, ensuring everyone uses the same toolchain version.
Can you use Brew to install Go on Linux?
Yes. Homebrew runs on Linux as Linuxbrew, allowing you to install Go via brew install go and manage updates similarly to macOS. Ensure you have the Linux environment prepared and Git installed if you plan to build from source.
Yes, you can use Homebrew on Linux to install Go, keeping your development setup consistent across platforms.
Do I need sudo to install Go with Brew?
Typically no. Brew operates in user space and does not require sudo. If you encounter permission issues, run brew doctor and verify directory permissions, but avoid using sudo with Brew as a general rule.
No, Brew usually runs without sudo; if there are permission problems, fix them rather than running Brew with elevated privileges.
How do I switch Go versions installed with Brew?
Install the desired version using brew install go@X and switch to it with brew link --force --overwrite go@X. Then verify with go version to ensure the correct toolchain is active.
You can switch Go versions by installing the specific version and relinking it, then checking the version to confirm.
What should I do if brew install go fails?
Run brew update, run brew doctor to diagnose issues, check PATH, and review any error messages. If necessary, reinstall Brew or try an alternative method such as downloading Go from the official site temporarily.
If installation fails, update Brew, diagnose with brew doctor, fix PATH issues, and consider reinstalling or troubleshooting network fixes.
Main Points
- Install Go with Brew for a repeatable, low-friction setup
- Pin the Go version when needed to stabilize builds
- Verify installation with go version and go env after setup
- Configure GOPROXY for faster module downloads and caching