How-To Guides5 min read

How to Install Homebrew on Apple Silicon Mac and Fix Zsh PATH Errors

Install Xcode Command Line Tools and Homebrew into /opt/homebrew on Apple silicon, wire brew shellenv into ~/.zprofile, and resolve zsh command not found errors.

To install Homebrew on an Apple silicon Mac, install Xcode Command Line Tools with xcode-select --install, run the official installer under /bin/bash, and append eval \"$(/opt/homebrew/bin/brew shellenv zsh)\" to ~/.zprofile so zsh finds brew in /opt/homebrew/bin.

Key takeaways

  • Always put brew shellenv in ~/.zprofile for macOS Terminal login shells.
  • Never run sudo brew install because it breaks prefix file ownership.
  • Verify architecture with uname -m so Terminal is running natively in arm64 rather than Rosetta.

Quick facts

  • On Apple silicon Macs, Homebrew installs into /opt/homebrew rather than /usr/local.
  • Homebrew supports Apple silicon Macs running macOS Sequoia 15 through macOS 27 Golden Gate as Tier 1 platforms.
  • Skipping the post-install brew shellenv step is the top cause of zsh: command not found: brew.
  • Homebrew formula installs do not require sudo once /opt/homebrew is provisioned.
  • Never install Homebrew inside protected macOS folders such as Desktop, Documents, or Downloads.

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.

Apple Silicon Homebrew Installation and Zsh PATH Resolution
Apple Silicon Homebrew Installation and Zsh PATH Resolution

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_64 Macs 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, and Downloads cannot 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:

ZSH
uname -m
command -v brew

You 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:

ZSH
xcode-select --install

Click 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/homebrew and asks for your sudo password once during setup. Never run sudo brew install after installation, and back up ~/.zprofile or ~/.zshrc before 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:

ZSH
/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:

ZSH
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:

ZSH
which brew
brew --version
brew doctor

If 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.

Sources