The message zsh: command not found: brew often comes from missing shell setup rather than missing Homebrew files. Run the existing executable by its full path first. If it works, load its shell setup without reinstalling packages.
A Mac that never had Homebrew needs an installation. That's different from a command lost after migration, a shell change or a startup-file edit. Check which situation applies before replacing anything.
In this guide
1. Find out whether brew still runs by its full path
Open Terminal and try the standard Apple silicon location:
/opt/homebrew/bin/brew --version
On an Intel Mac, check the standard Intel location instead:
/usr/local/bin/brew --version
A Homebrew version means the program is present and can run from that location. The short command fails because your shell's PATH, the list of folders searched for commands, doesn't lead to that executable.

A missing-file error means brew isn't at that location. It could still be installed somewhere else. Check the location in your installer output or migration notes before deciding Homebrew has disappeared.
Apple silicon Macs can also have an Intel installation used with Rosetta. Don't combine the two paths just to make an error vanish. Choose the installation you intend to use and keep using its full path during these checks.
Homebrew's installation documentation gives the standard prefixes. If neither location contains an installation and this is a new setup, follow the separate Homebrew installation guide.
2. Load the working installation into this session
For the Apple silicon installation that passed the version check, enter:
eval "$(/opt/homebrew/bin/brew shellenv zsh)"
For the standard Intel installation, use:
eval "$(/usr/local/bin/brew shellenv zsh)"
These are alternatives. Run the line matching the executable you just checked, then enter brew --version without the full path. The command should now return a version in this Terminal session.
The shellenv command prints the settings your shell needs to find that installation. eval applies those settings, including the command search path, to your current shell. This doesn't reinstall Homebrew or upgrade applications.
If this line fails after the full path worked, copy the new error. Quotes that changed when you pasted the command, or a different shell, can keep the setup from loading. Check your shell before saving the line in a startup file.
3. Make the setup survive a new Terminal window
Run echo $SHELL to check your configured shell. The usual Mac shell is zsh, but older accounts and customized terminals can use another one. Don't put a zsh fix into a bash configuration and expect zsh to read it.
For zsh on macOS, Homebrew's manual recommends putting the command that loads its shell setup in ~/.zprofile. The tilde means your home folder. Add the working eval line from the previous section to that file with a plain-text editor.
Copy .zprofile before editing, and keep its existing settings. Look for an existing Homebrew setup line. If that line points to the wrong installation, correct its path instead of adding another setup line.
Open a new Terminal window, then run brew --version again. If it works there, your shell is loading the setup at startup. If it works only in the original window, a new shell still isn't loading the change.
For bash on macOS, use ~/.bash_profile, and the shell argument becomes bash. Use the same full executable path that passed the first check, followed by shellenv bash inside the matching eval command.
Other shells need their own syntax. The shellenv entry in the manual lists supported shells. Don't assume a command written for zsh will work unchanged in fish or PowerShell.
4. Check why one terminal works and another doesn't
If the command works in Terminal but fails inside an editor's terminal, start a fresh terminal session in that editor. An already-open shell keeps its earlier environment even after the startup file has been repaired.
Compare command -v brew in both places. In the working shell it should print the executable path. A different path in the other shell means you're reaching a different installation; an empty result means that shell still can't find brew.
The Terminal shell settings show how to check Terminal > Settings > General > Shells open with. A custom command there can start a different shell from the one you configured.
A managed Mac may use an administrator-selected shell. Give IT the working executable path and the failing terminal's shell. They can fix the settings your session starts with, so you won't need to change company startup files yourself.
If brew fails only in a script, check how that script starts its shell. It may read different settings from your interactive Terminal. Ask its maintainer to configure that environment instead of copying personal settings into system files.
5. Treat a different error as a different problem
After brew --version works, treat a package-installation error separately. Save its wording and package name. More PATH edits won't repair a failed download, unsupported package or developer-tools prompt.
If macOS repeatedly asks for developer tools, use the Command Line Tools prompt checks. That prompt has its own causes and doesn't call for deleting your Homebrew folder.
Avoid sudo brew as a shortcut for this error. Administrator access doesn't add the missing executable to your normal shell's search path, and normal package operations should run without sudo.
If brew won't run from any installation path, compare the current requirements with your installer output. Keep package folders intact while getting help.
For a damaged installation, send Homebrew support your Mac's chip, macOS version, shell and the error from running brew by its full path.
The Short Version
Run brew by its full path first. If it works, apply that installation's shellenv setup and save the matching line in the startup file your shell reads. Verify it from a new terminal before installing anything again.
Checked November 27, 2026.







