How to install Homebrew on Mac
Learn how to install Homebrew on Mac, verify the installation, and manage packages. This step-by-step guide covers prerequisites, the official install script, PATH setup, troubleshooting, and practical usage for developers and DIY enthusiasts.

Why macOS benefits from Homebrew
macOS users often lean on Homebrew to manage open-source command-line tools. It provides a cohesive, user-friendly way to install, update, and remove software without cluttering the system with manual builds or unmanaged binaries. Homebrew keeps software isolated in its own directory, resolving dependencies and avoiding conflicts with the operating system’s own tools. For developers and power users, Homebrew simplifies tasks from installing programming languages to data-processing utilities, all through a consistent, predictable workflow. Whether you’re a hobbyist, a student, or a professional, Homebrew on Mac helps you stay productive while maintaining system stability.
Key takeaways:
- Centralized management of CLI tools
- Safe isolation from system directories
- Consistent updates and dependency handling
Prerequisites and system checks
Before installing Homebrew on Mac, confirm a few prerequisites to ensure a smooth setup. Ensure your macOS version is reasonably up-to-date and that you have a working internet connection. You’ll also want administrator access on the machine, since password prompts may appear during installation. Apple Silicon (M1/M2) and Intel Macs both support Homebrew, but you’ll typically see different default installation paths. Finally, be prepared to install the Xcode Command Line Tools if they’re not already present on your system.
Checklist:
- macOS version that’s reasonably current
- Active internet connection
- Administrative access
- Xcode Command Line Tools as a prerequisite
Install Xcode Command Line Tools (CLT)
Homebrew requires the Xcode Command Line Tools to compile and install many formulas. Open Terminal and run the command to install CLT: xcode-select --install. A software update dialog will guide you through the installation. After installation, verify by running xcode-select -p to confirm the path, and accept the Xcode license if prompted. If the tools are already installed, this step will be skipped automatically on most systems.
Why this matters: CLT provides essential compilers and headers that Homebrew relies on for building software from source. Without them, many brew formulas will fail to install.
The official Homebrew install command and what it does
With prerequisites in place, you download and run the official install script from Homebrew. In Terminal, paste the script provided on Homebrew’s website, which typically looks like /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". The installer will create the Homebrew directory (either /usr/local for Intel or /opt/homebrew for Apple Silicon), configure PATH, and set up the basic environment. You’ll be prompted to enter your password to authorize installations. The script also performs architecture checks to ensure compatibility before proceeding.
What to expect: The process may take several minutes depending on network speed and system performance. After completion, the script prints next steps and PATH configuration details. You’ll now have a dedicated package manager to install additional software with a simple brew command.
PATH configuration and shell differences
After the install script completes, you may need to configure your shell so the brew command is found in your PATH. On Apple Silicon Macs, Homebrew commonly installs to /opt/homebrew, while Intel Macs use /usr/local. The recommended approach is to use Homebrew’s shellenv to set PATH correctly across shells and sessions. Run the following (adjust for your shell):
- For zsh: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc && source ~/.zshrc
- For bash: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile && source ~/.bash_profile
If you’re unsure which path to use, you can rely on brew shellenv to configure environment variables automatically. After updating your profile, restart Terminal and run brew --version to verify.
Tip: You can also temporarily load Brew’s environment with: eval "$($(brew --prefix)/bin/brew shellenv)".
Verifying the installation and basic usage
With PATH configured, verify the installation by checking the version and updating the package index. Run brew doctor to detect common issues, then brew --version to confirm the Brew CLI is accessible. Next, update the package list with brew update and perform a quick test install, such as brew install git. This confirms you can fetch, compile, and install software from Homebrew’s repositories. Exploring a few additional commands like brew list and brew info <formula> will help you learn how to discover and inspect available packages.
Pro tip: If something seems off, use brew config to display your Homebrew environment, and verify your PATH order to ensure the correct brew binary is being used.
Common issues and quick fixes
Even with care, issues can arise during or after installation. A common symptom is a command not found error for brew, usually caused by PATH not being updated or sourced correctly. If you encounter a permissions-related message, avoid using sudo with brew; instead, check directory ownership and permissions of the Homebrew prefix (usually /usr/local or /opt/homebrew). Some macOS setups require you to accept the Xcode license before installations can proceed. If the installer reports architecture mismatches, re-run the script and confirm you downloaded the correct installer for your Mac’s CPU type. Finally, consult brew doctor output for targeted remediation steps.
Quick checks:
- Is brew in PATH? type -a brew
- Are Xcode licenses accepted? sudo xcodebuild -license
Practical usage: installing packages and keeping Homebrew updated
Once Homebrew is installed, you can quickly add essential tools and utilities. Examples include git for version control, wget or curl for data transfer, and Python or Node.js for development environments. Use brew install <formula> to add software, and brew uninstall <formula> to remove it. Regular maintenance helps keep your system clean and secure: run brew update to fetch latest formula definitions, brew upgrade to update installed packages, and brew cleanup to remove old downloads and caches. Remember to update your PATH if you install tools in non-standard locations.
Real-world workflow: Install a language runtime, a version manager, and a few utilities you rely on daily; then set up a simple Brewfile to automate future installations.
Security, maintenance, and long-term care
Security and maintenance are ongoing with Homebrew. Regularly run brew update and brew upgrade to keep software current, and use brew doctor to catch configuration issues early. Avoid running brew commands with sudo; Homebrew manages permissions within its own prefix. For sensitive environments, review the list of installed formulas periodically and use brew audit to check for potential issues in your Brewfile. Documentation and community forums are your best resources when encountering uncommon edge cases. Stay curious, and keep your installation environment clean and reproducible.
