How To Install Homebrew On Mac

I’m trying to install Homebrew on my Mac so I can easily manage and install command line tools, but I’m confused by the different instructions I’ve found online. Some guides use Terminal commands that don’t match what I’m seeing, and I’m not sure which steps are safe or up to date. Can someone walk me through the correct, current way to install Homebrew on macOS and any important things I should set up right after the install for best performance and security?

Short version, do this, then you are done.

  1. Check your mac chip

Open Terminal and run:
uname -m

If you see:

  • arm64 → Apple Silicon (M1, M2, M3)
  • x86_64 → Intel
  1. Install Xcode command line tools

Homebrew needs the compiler tools.

Run:
xcode-select --install

If it says they are already installed, fine, move on.

  1. Use the official Homebrew install command

Go to:

Copy the command from the big box. As of now it is:

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

For Apple Silicon it is the same command. The script auto detects your chip and picks the path.

Paste it in Terminal and press Enter. Let it run. If it asks for your password, enter your mac login password.

  1. Add Homebrew to your PATH

At the end, the script prints some lines like:

For Apple Silicon:
echo ‘eval ‘$(/opt/homebrew/bin/brew shellenv)’’ >> ~/.zprofile
eval ‘$(/opt/homebrew/bin/brew shellenv)’

For Intel:
echo ‘eval ‘$(/usr/local/bin/brew shellenv)’’ >> ~/.zprofile
eval ‘$(/usr/local/bin/brew shellenv)’

Copy and run what it suggests. Do not guess the path, use what the installer prints.

If you use Bash instead of zsh, it might say .bash_profile instead of .zprofile. Again, follow the text it prints.

  1. Check it works

Close Terminal. Open a new Terminal window.

Run:
brew --version

If you see a version number, it is installed.

  1. First update

Run:
brew update
brew doctor

If brew doctor prints warnings, read them. Most times it tells you exactly what to fix, like “run this command to clean up”.

  1. Install a quick test package

Example:
brew install wget

Run:
wget --version

If that works, your setup is fine.

Common confusion you saw in guides, quick notes

  • Old guides put Homebrew in /usr/local only. On Apple Silicon it lives in /opt/homebrew.
  • Some guides tell you to edit PATH by hand. The new way is brew shellenv. Trust the lines the installer shows.
  • Do not run random scripts from blogs. Always use the command from https://brew.sh.

If something fails, copy the full Terminal output and error. Post it and people can point at the exact problem instead of guessing.

The part that usually causes the confusion is not the install command itself (that’s already covered nicely by @viaggiatoresolare), it’s everything around it: shells, config files, and “why does brew work in one window but not another?”

Here’s how I’d frame it so you can sanity‑check whatever guide you’re reading.


1. Ignore any guide that:

  • Mentions ruby -e '$(curl ... → that’s ancient.
  • Hardcodes /usr/local/bin/brew for Apple Silicon.
  • Tells you to edit PATH manually with some huge export PATH=/something:$PATH guess.

If you see those, close the tab. Seriously.


2. Where Homebrew actually lives

You don’t need to memorize it, but it helps you understand the mismatch in guides:

  • Intel Mac: /usr/local/Homebrew with brew in /usr/local/bin/brew
  • Apple Silicon: /opt/homebrew with brew in /opt/homebrew/bin/brew

Some older “universal” guides are confusing because they only mention /usr/local and never updated for Apple Silicon.

You can always verify after install with:

which brew
brew --prefix

If which brew prints nothing, your PATH isn’t set up properly, not that the install “failed”.


3. Shell confusion: zsh vs bash

A lot of conflicting instructions come from different default shells:

  • Newer macOS: default is zsh
  • Older setups or manual changes: you might still be using bash

Run:

echo $SHELL

If it ends with /zsh, your config file is usually ~/.zprofile or ~/.zshrc.
If it ends with /bash, your config file is usually ~/.bash_profile or ~/.bashrc.

I slightly disagree with the “just blindly follow the script output” idea in the sense that you should at least know which file it’s editing so you can fix it later. Check the file it mentions, open it in a text editor, and confirm the new eval '$(/opt/homebrew/bin/brew shellenv)' (or similar) line is actually there.


4. Minimal PATH sanity check

After install and after running the suggested eval lines, open a new Terminal window and run:

echo $PATH
which brew

On Apple Silicon you should see something early in PATH like /opt/homebrew/bin.
On Intel you should see /usr/local/bin.

If PATH looks wrong, it’s usually because:

  • You have another line later in your config re‑setting PATH and wiping the brew part.
  • You copied some random “fix your PATH” block from a blog that overrides everything.

In that case, look for lines like:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

and either remove or adjust them, because they’re nuking what Homebrew added.


5. How to safely re-run the setup part

If you suspect the PATH step is messed up but don’t want to reinstall:

# Apple Silicon, adjust if needed
/opt/homebrew/bin/brew shellenv

That prints the correct eval line. Add that manually to the appropriate file for your shell (zprofile or bash_profile, etc). No need to re-run the whole installer just to fix PATH.


6. Quick checklist when guides don’t match

  • Use only the install command from brew.sh.
  • Confirm your chip: uname -marm64 vs x86_64.
  • Confirm your shell: echo $SHELL.
  • Make sure the brew shellenv line is in the right config file for that shell.
  • Open a new Terminal window before testing brew.

Once that all lines up, everything else (installing packages, brew update, brew doctor, like @viaggiatoresolare covered) tends to “just work”.

If you’re still stuck, paste exactly:

  • output of uname -m
  • output of echo $SHELL
  • result of which brew and brew --version

and the error messages you see. That’s usually enough to pinpoint what’s off.