How to Install Homebrew on macOS: A Complete Setup Guide

Homebrew is the most widely used package manager for macOS — and for good reason. It lets you install command-line tools, programming languages, databases, and developer utilities with a single terminal command, without wrestling with manual downloads or complex configuration files. If you're setting up a development environment on a Mac, understanding how Homebrew works and how to install it correctly is a foundational step.

What Is Homebrew and Why Do Developers Use It?

A package manager automates the process of installing, updating, and removing software. On macOS, Apple doesn't ship a built-in package manager for developer tools, so Homebrew fills that gap.

Once installed, Homebrew lets you run commands like:

brew install git brew install node brew install postgresql 

Rather than visiting individual websites, downloading installers, and managing dependencies manually, Homebrew handles all of that for you. It installs packages into their own directories and symlinks them into a standard location, keeping your system clean and organized.

Formulae are Homebrew's packages for command-line tools. Casks extend Homebrew to install full macOS applications — like browsers, code editors, and design tools — using the same workflow.

What You Need Before Installing Homebrew

Before running the install command, a few prerequisites matter:

  • macOS version: Homebrew officially supports macOS Ventura, Monterey, Big Sur, and recent releases. Older versions of macOS may still work but receive limited support.
  • Apple Silicon vs. Intel: Homebrew runs natively on both Apple Silicon (M1/M2/M3) and Intel Macs, but the default installation path differs. On Apple Silicon, Homebrew installs to /opt/homebrew. On Intel Macs, it uses /usr/local. This distinction matters if you're following older documentation.
  • Xcode Command Line Tools: Homebrew requires Apple's Xcode Command Line Tools, which include compilers and build utilities. The Homebrew installer can trigger this installation automatically, but knowing it's a dependency helps you understand what's happening during setup.
  • Terminal access: You'll need access to Terminal (or a terminal emulator like iTerm2). No prior command-line expertise is required for the installation itself.

Step-by-Step: Installing Homebrew on macOS 🍺

Step 1 — Open Terminal

Open Terminal from Applications → Utilities, or search for it with Spotlight (⌘ + Space, then type "Terminal").

Step 2 — Run the Official Install Script

Paste the following command into Terminal and press Return:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

This command downloads and runs the official Homebrew installation script directly from the Homebrew GitHub repository. Always use the command from brew.sh to ensure you're getting the current, verified version.

Step 3 — Follow the Prompts

The installer will:

  1. Display what it plans to install and where
  2. Ask for your macOS user password (required to create directories)
  3. Install Xcode Command Line Tools if they aren't already present — this step can take several minutes
  4. Download and install Homebrew itself

Step 4 — Add Homebrew to Your PATH (Apple Silicon Macs)

On Apple Silicon Macs, the installer will display a message after completion asking you to add Homebrew to your PATH. This typically involves running two commands in Terminal — the installer will show the exact commands for your setup. They look similar to:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)" 

On Intel Macs, Homebrew is added to the PATH automatically.

Skipping this step is one of the most common reasons new users see a brew: command not found error after installation.

Step 5 — Verify the Installation

Run the built-in diagnostic command:

brew doctor 

A healthy installation returns Your system is ready to brew. If warnings appear, Homebrew usually describes what to fix and how.

Key Factors That Affect Your Homebrew Setup

FactorWhat Changes
Apple Silicon vs. IntelInstall path differs; PATH setup may require manual step
macOS versionOlder versions may have limited formula support
Shell type (zsh vs. bash)PATH configuration targets different profile files
Existing Xcode installationFull Xcode vs. Command Line Tools only can affect some builds
Network/proxy environmentsCorporate networks may block the install script or formula downloads

Common Post-Installation Tasks

Once Homebrew is installed, a few commands form the core of daily use:

  • brew install [package] — install a new tool
  • brew update — update Homebrew's package index
  • brew upgrade — upgrade installed packages
  • brew list — see what's installed
  • brew uninstall [package] — remove a package
  • brew install --cask [app] — install a macOS application

Keeping Homebrew updated is good practice, particularly before installing new tools, since outdated formula definitions can cause build failures.

Shell Configuration and Multiple Environments 🔧

If you use multiple shell environments — for example, running both zsh (macOS default since Catalina) and bash — you may need to add the Homebrew PATH configuration to the relevant profile file for each. The profile files involved are typically ~/.zprofile, ~/.zshrc, ~/.bash_profile, or ~/.bashrc, depending on your shell and how it loads configuration.

Developers working with version managers like nvm, rbenv, or pyenv should also be aware that load order in shell profile files matters — Homebrew's PATH entry should generally appear before version manager initializations to avoid conflicts.

What Shapes the Experience Differs By Setup

A straightforward install on a modern Mac with a fresh macOS version and a standard home network is genuinely simple — the whole process typically takes under ten minutes. The experience shifts noticeably depending on factors like your chip architecture, which shell you're running, whether your Mac is managed by an organization with restricted permissions, or whether you're integrating Homebrew into an existing development environment with multiple tools already configured.

Understanding those variables — your macOS version, chip type, shell configuration, and existing toolchain — is what determines whether the standard steps are sufficient or whether your specific setup calls for adjustments.