Installing Homebrew on a Mac takes less than five minutes, yet almost every developer I help hits the exact same failure at the end: the installer finishes cleanly, and then Terminal prints zsh: command not found: brew. That error does not mean Homebrew failed to install. It means your Apple silicon Mac placed Homebrew inside /opt/homebrew, and your shell does not know to look there until you wire brew shellenv into ~/.zprofile.
On current macOS releases from Sequoia 15 through macOS 27 Golden Gate, Homebrew gives Tier 1 support to Apple silicon Macs, while Intel Macs remain in Tier 3 compatibility. I prefer installing Homebrew via the official shell script (or Apple silicon .pkg installer on managed machines) and keeping /opt/homebrew owned strictly by my user account rather than ever touching sudo brew.
Original SVG diagram by Ajay Kumar Chaturvedi (CC BY 4.0).
Prerequisites
Before running the installer, verify that your workstation meets these requirements:
- An Apple silicon Mac running macOS Sequoia 15, Tahoe 26, or macOS 27 Golden Gate (Intel
x86_64Macs still work as Tier 3 using/usr/local, though binary bottle support is narrower). - An administrator account password for the one-time creation of
/opt/homebrew. - At least 5 GB of free internal SSD storage outside iCloud-synced folders (
Desktop,Documents, andDownloadscannot host Homebrew reliably because macOS TCC privacy restrictions block sandboxed processes). - A working internet connection to GitHub and Homebrew package registries.
I would skip custom installation prefixes unless you maintain an isolated sandbox for a narrow toolset. Using a non-standard prefix disables prebuilt binary bottles for many formulae and forces slow local compilation from source.
Step-by-Step Homebrew Installation
Step 1: Verify your chip architecture and check for an existing install
Open Terminal from Applications > Utilities and run these two read-only checks first:
uname -m
command -v brewYou want uname -m to return arm64. If it returns x86_64 on an Apple silicon Mac, Terminal is running under Rosetta translation, which will confuse the installer. If command -v brew prints /opt/homebrew/bin/brew, Homebrew is already installed and on your PATH.
Step 2: Install Xcode Command Line Tools
Apple's Command Line Tools provide git, clang, make, and header files that Homebrew uses when building formulae from source or updating taps. Trigger the system dialog from Terminal:
xcode-select --installClick Install in the popup prompt and wait for the download to finish. If macOS tells you the tools are already installed, run xcode-select -p to confirm it prints /Library/Developer/CommandLineTools (or your full Xcode developer directory).
Step 3: Run the official Homebrew installation script
Permission Warning: Read the prompt carefully before confirming. The installer creates/opt/homebrewand asks for yoursudopassword once during setup. Never runsudo brew installafter installation, and back up~/.zprofileor~/.zshrcbefore appending configuration lines if you already maintain custom dotfiles.
Homebrew's official one-liner explicitly invokes /bin/bash, which works regardless of whether your interactive Terminal defaults to zsh or fish. Run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Review the directory plan printed in Terminal, press Return to confirm, and enter your login password when prompted. If you prefer a signed graphical package on an Apple silicon Mac, Homebrew also publishes a .pkg installer on its official GitHub releases page that targets /opt/homebrew.
Step 4: Add Homebrew to Zsh via ~/.zprofile
Once installation completes, Homebrew prints a Next steps block containing exact shellenv commands for your environment. Always inspect your existing ~/.zprofile before appending, or add the Apple silicon zsh line directly:
cp ~/.zprofile ~/.zprofile.bak 2>/dev/null || true
echo 'eval "$(/opt/homebrew/bin/brew shellenv zsh)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv zsh)"The first line creates a quick safety copy if ~/.zprofile already exists. The second line ensures every future macOS Terminal login window initializes HOMEBREW_PREFIX, HOMEBREW_CELLAR, and PATH automatically. The third line activates Homebrew immediately inside the Terminal tab you already have open.
Step 5: Verify ownership, prefix, and system health
Run these diagnostic commands to confirm the installation is healthy and points to /opt/homebrew:
which brew
brew --version
brew doctorIf everything is wired cleanly, which brew prints /opt/homebrew/bin/brew and brew doctor prints Your system is ready to brew.
Expected Result
Every new Terminal window resolves brew immediately without manual export PATH edits, brew doctor reports zero fatal permission warnings, and routine installs like brew install git or brew install jq succeed without invoking sudo.
Troubleshooting
Error: zsh: command not found: brew right after install
You skipped Step 4, or you edited ~/.bashrc instead of ~/.zprofile. macOS Terminal opens zsh login shells by default, which read ~/.zprofile and ~/.zshrc. Verify whether /opt/homebrew/bin/brew exists on disk, then re-run the eval line and append it to ~/.zprofile.
brew doctor warns that /usr/local/bin comes before /opt/homebrew/bin
This happens on Macs migrated from older Intel hardware via Migration Assistant. Check echo $PATH and inspect ~/.zprofile and ~/.zshrc for hardcoded /usr/local/bin prepends. Moving eval "$(/opt/homebrew/bin/brew shellenv zsh)" after legacy path exports places Apple silicon binaries first.
Error: Operation not permitted or sandbox read failures
Homebrew stops if you attempt to run it inside ~/Desktop, ~/Documents, ~/Downloads, or an external volume because macOS privacy controls block sandboxed processes from reading those paths. Keep Homebrew strictly inside /opt/homebrew on your internal startup volume.
Cask installation asks for a password or fails under non-admin accounts
While regular formulae never need sudo, GUI .app casks that drop files into /Applications or install system launch daemons may prompt for administrator credentials. On restricted accounts, Homebrew docs note that you can redirect user-writable apps with --appdir="$HOME/Applications" or set export HOMEBREW_NO_SUDO=1 to catch privileged steps cleanly.
