To install Homebrew on a Mac with Apple silicon, you run one curl command and then add /opt/homebrew to your PATH yourself. Most “command not found: brew” reports come from skipping that second part, because the installer prints the fix at the very bottom of a long scroll.
This guide walks through the installer, the .zprofile line, the errors you are likely to hit and a clean uninstall. We checked every step in November 2026 on a macOS 27.2 virtual machine on an M4 Mac mini, after removing the Homebrew and Command Line Tools its image ships with, and all output below comes from that run.
What do you need before installing Homebrew?
You need an Apple silicon Mac on macOS 15 Sequoia or newer, an admin account and access to GitHub. The installer we ran treats 15.0 as the oldest supported release: below it, or from 28.0 up, it prints an unsupported warning and carries on, so macOS 27 installs without one. The admin account matters because the script uses sudo to create /opt/homebrew, so an account without sudo stops with “Insufficient permissions to install Homebrew”. Intel Macs are no longer an option, which we cover further down.
Check the chip, the macOS version and the Command Line Tools in one line. Run it in the terminal app you plan to use for Homebrew, because a terminal set to open under Rosetta reports x86_64 instead of arm64.
uname -m; sw_vers -productVersion; xcode-select -p
On our test VM the three lines came back as arm64, 27.2 and the CLT path. Its image ships with both tools, so we deleted the bundled Homebrew and the CLT first, after which xcode-select -p and brew both failed the way they do on a new Mac.

Your output should look the same apart from the version number. Before you go further, confirm each of these on your own machine:
- The first line says
arm64. Anx86_64on an M-series Mac means the terminal runs under Rosetta. - The second line is 15.0 or higher.
- Your account shows as Admin in System Settings, Users & Groups.
The Command Line Tools are optional at this point. With them gone, the installer found and installed them headless through softwareupdate without opening any dialog, so a missing CLT costs you download time and nothing else. If you want them in place first, or you hit the “invalid active developer path” error later, see our guide to installing the Xcode Command Line Tools.
How do you install Homebrew on a Mac?
Paste the official one-liner into Terminal as your normal user. Do not put sudo in front of it, because the script aborts with “Don’t run this as root!” and asks for your password itself when it needs it.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The script first checks sudo access, so a Password: prompt appears and nothing echoes as you type. It then lists what it will create and stops at a RETURN prompt:

Read that list before you press Return, because it is your last chance to catch a wrong prefix. Every path starts with /opt/homebrew, which confirms the script saw Apple silicon. The list also includes /etc/paths.d/homebrew, a one-line file that matters in the PATH section below, and the final line tells you whether the Command Line Tools will be installed. The rest of the run follows this order:
- Press Return at “Press RETURN/ENTER to continue or any other key to abort”.
- Wait while it downloads the Command Line Tools, if they are missing, and clones Homebrew into
/opt/homebrew. - Check that the output ends with “Installation successful!” and a “Next steps” block.
On our VM the whole run, Command Line Tools for Xcode 27.2 included, took 2 minutes 57 seconds. Near the end the script installs /etc/paths.d/homebrew owned by root, then prints the three PATH commands with your own home directory filled in:

For a provisioning script, put NONINTERACTIVE=1 in front of the command and the RETURN prompt is skipped. The script still needs sudo, so run it from an account with cached or passwordless sudo. In this mode it calls sudo -n, which fails instead of prompting, so a provisioning run without sudo stops early rather than hanging. It also honours SUDO_ASKPASS if your tooling supplies the password that way.
How do you add brew to your PATH?
Run the three commands from the “Next steps” block. They append the brew shellenv line to ~/.zprofile and load it into the window you are in:
echo >> ~/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv zsh)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv zsh)"
The installer picks .zprofile because Terminal and iTerm2 start login shells, which read that file once per window. Putting the line in .zshrc instead would run it again in every nested shell. If your shell is bash, the Next steps block points at ~/.bash_profile with shellenv bash, so copy the lines your installer printed if they differ from these.
Open a new window and check where the shell finds git and brew now. A new window matters here, since .zprofile only runs when a login shell starts.
which -a git brew; git --version; brew --prefix; echo $PATH | tr : "\n" | head -6
The /opt/homebrew/bin and /opt/homebrew/sbin entries now sit at the top of PATH, and git resolves to the 2.56.0 build from Homebrew:

The /opt/homebrew/bin entry shows up twice in which -a because the paths.d file adds a second copy at the end of PATH. That duplicate does no harm, since the shell stops at the first match, so you can leave it alone.
Why is /etc/paths.d/homebrew not enough on its own?
Because macOS appends paths.d entries after /usr/bin, so the Apple tools keep winning. We opened a login shell before running the Next steps, and brew already worked, but /opt/homebrew/bin was the very last PATH entry. After brew install git wget, Homebrew itself warned that its git was shadowed, and which -a git still listed the Apple copy first.

That run reported Apple Git 2.54.0 instead of the 2.56.0 we had just installed. Any formula that shares a name with a tool in /usr/bin behaves the same way, so the newer version sits on disk while the old one answers. Treat the paths.d file as a fallback that keeps brew reachable, and keep the shellenv line, which also sets HOMEBREW_PREFIX, INFOPATH and the zsh completion path.
How do you check the install worked?
Run brew doctor, then confirm the version and prefix with brew config. Doctor only reports problems, so a short output is a good sign:
brew doctor
brew --version; brew config | head -14
We got Homebrew 7.0.11 with prefix /opt/homebrew on 27.2-arm64. Doctor raised one warning, about TartMetalCapabilities.dylib in /usr/local/lib:

That file comes from the Tart virtual machine we tested in, so you won’t see it on a physical Mac. Without warnings, doctor prints “Your system is ready to brew.” Read any warning you do get, because stray files in /usr/local from old installers are the usual cause. If every brew install feels slow because of the index refresh, you can disable Homebrew auto update.
Why does zsh say “command not found: brew”?
Your shell cannot see /opt/homebrew/bin, either because Homebrew isn’t installed there or because that shell never loads the PATH setup. The exact wording tells you which case you have, so match yours against the headings below.
zsh: command not found: brew
Start by checking whether the binary exists, which separates “not installed” from “not on PATH”. The second command looks for the shellenv line in both zsh startup files:
ls -l /opt/homebrew/bin/brew; grep -n shellenv ~/.zprofile ~/.zshrc 2>/dev/null
Use the result to pick the fix:
- If
lsfinds the file andgrepfinds nothing, run the three PATH commands from the previous section. - If
lsreports “No such file or directory”, Homebrew is not installed at the Apple silicon prefix, so run the installer again. - If both checks pass and a new window still fails, your terminal app runs a custom command instead of a login shell, so check its profile settings.
An old /usr/local/bin/brew from an Intel Mac counts as not installed on Apple silicon. Reinstall at /opt/homebrew rather than pointing PATH at the old copy, because that copy only runs under Rosetta and installs Intel builds of everything.
zsh:1: command not found: brew over ssh, cron or scripts
The zsh:1: prefix means a non-login shell ran a single command. Neither .zprofile nor /etc/paths.d is read in that case, so brew fails even on a correctly set up Mac. We reproduced it from another machine with ssh devbox brew --version, on the same Mac where Terminal found brew without trouble.

Both workarounds in that capture are reliable. Wrap the command in a login shell with zsh -lc "brew ...", or call /opt/homebrew/bin/brew by its full path. In cron jobs, launchd agents and CI scripts the full path is the safer choice, since nothing there reads your dotfiles.
Homebrew on macOS is only supported on Apple Silicon processors!
The installer stops with this message whenever uname -m reports x86_64. We triggered it on the Apple silicon VM by running the installer through Rosetta with arch -x86_64, and it exited with status 1 before touching the disk.

On an M-series Mac the cause is a terminal set to open under Rosetta. Select Terminal in Applications, Utilities, choose Get Info, clear “Open using Rosetta”, then open a new window and confirm uname -m prints arm64. On a real Intel Mac the installer won’t run at all. The Homebrew installation docs still list 64-bit Intel as a Tier 3 configuration, but the current install.sh refuses it, so keep any existing /usr/local install you have or look at MacPorts.
.zprofile:2: no such file or directory: /opt/homebrew/bin/brew
This prints as soon as a new window opens, and it means the reverse problem: Homebrew is gone but .zprofile still runs its eval line. The uninstaller never edits your dotfiles, so delete the line as shown at the end of the uninstall section below.
Where does Homebrew live on Apple silicon and Intel?
Apple silicon Homebrew lives under /opt/homebrew, while Intel installs used /usr/local. Older tutorials written for Intel point at paths that don’t exist on your Mac, and the table shows the differences that matter:
| Item | Apple silicon | Intel (legacy) |
|---|---|---|
Prefix (brew --prefix) | /opt/homebrew | /usr/local |
| brew binary | /opt/homebrew/bin/brew | /usr/local/bin/brew |
| Installed formulae | /opt/homebrew/Cellar | /usr/local/Cellar |
| Download cache | ~/Library/Caches/Homebrew | ~/Library/Caches/Homebrew |
| On PATH without setup | Only at the end, via /etc/paths.d/homebrew | Yes, /usr/local/bin is in /etc/paths |
| Current installer | Supports macOS 15 and newer | Aborts with the Apple Silicon message |
The PATH row explains why older guides never mention shellenv: on Intel, /usr/local/bin was already on the system PATH. If you moved from an Intel Mac with Migration Assistant, check for a leftover copy:
ls -d /usr/local/Homebrew /usr/local/Cellar 2>/dev/null; which -a brew
If either directory exists, remove that copy with the --path /usr/local option of the uninstaller from the next section. It only runs under Rosetta, and because /usr/local/bin is in /etc/paths, its binaries can still answer for tools you never reinstalled under /opt/homebrew.
How do you uninstall Homebrew completely?
Run the official uninstall.sh from the account that installed Homebrew, then delete the leftover prefix and your shellenv line. The script removes the Cellar, the brew repository and /etc/paths.d/homebrew, but it never touches your dotfiles. Save a list of what you installed first, so a later reinstall is one brew bundle away.
brew bundle dump --file=~/Brewfile
Our Brewfile held two lines, brew "git" and brew "wget", each with its description as a comment. Next, download the uninstaller and do a dry run, which lists every file it would delete and removes nothing. It still asks for your password, because it uses sudo to list root-owned files:
curl -fsSLO https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh
/bin/bash uninstall.sh --dry-run
When the “This script would remove:” list looks right, run it for real. Answer y at “Are you sure you want to uninstall Homebrew?” and give your password when asked:
/bin/bash uninstall.sh
Run from the installing account, it finished cleanly with “Homebrew uninstalled!” and left only /opt/homebrew/etc/ behind:

A few flags change that behaviour, and the usage text at the top of the script lists them all.
--path /usr/localremoves an old Intel install instead of the Apple silicon one.--skip-cache-and-logskeeps~/Library/Caches/Homebrewand the logs.NONINTERACTIVE=1in front of the command implies--forceand skips the confirmation.
Apps you installed with brew install --cask are real bundles in /Applications. The script only clears entries there that link back into the Cellar, so run brew uninstall --cask on the apps you do not want before removing Homebrew. Any you keep stay on disk after the uninstall, but Homebrew no longer updates them.
Warning: Failed to delete /opt/homebrew/… Permission denied
You ran the uninstaller from a different admin account than the one that owns /opt/homebrew. The Homebrew in our VM had been installed by an account called admin, and running the script as harrison produced 6,108 “Permission denied” lines in its log. It still ended with “Homebrew uninstalled!”, so don’t take that message as proof on its own.

The script used sudo for the Cellar, the repository’s .git directory and the paths.d file, so packages were gone. Everything else still went through plain rm and failed, which left the working tree and bin/brew behind, still owned by admin. Check the owner with ls -ld /opt/homebrew and rerun the uninstaller as that user. If the account no longer exists, remove the prefix with sudo rm -rf /opt/homebrew after the run.
How do you clean up after the uninstaller?
Remove what is left of the prefix, then delete the shellenv line from .zprofile. Check that /opt/homebrew holds nothing you want to keep first, since this removes it for good:
sudo rm -rf /opt/homebrew
sed -i "" "/brew shellenv/d" ~/.zprofile
The sed line matches both the current shellenv zsh form and the older one without a shell name. Before we ran it, a new window printed the .zprofile:2 error from the troubleshooting section. Afterwards which brew printed “brew not found” and both paths were gone:

Remove any HOMEBREW_ exports you added to your dotfiles yourself, since the sed line only matches the eval. Then open one more window and check that it starts without errors.
Setup checklist
On a fresh Mac, every item below should check out before you start installing packages. Each one maps to a section above if it fails:
uname -mprintsarm64in the terminal you install from.- The installer output lists
/opt/homebrewpaths and ends with “Installation successful!”. ~/.zprofilecontains thebrew shellenvline exactly once.- In a new window,
which -a gitlists/opt/homebrew/bin/gitbefore/usr/bin/gitonce you install git. brew doctorreports no warnings you cannot explain.- Scripts and ssh commands call
/opt/homebrew/bin/brewby its full path.
With Homebrew working, shell setup comes next. Our Oh My Zsh on macOS guide builds on the same .zprofile. The brew cask error fix covers the current --cask syntax for apps, and the macOS 27 developer changes post lists what else moved in this release. The installer and uninstaller themselves live in the Homebrew/install repository.