DescubreApple

Apple, Mac, iPhone, iPad

OS X

How to Install and Use Homebrew on a Mac with Apple Silicon Step by Step

A practical guide to installing Homebrew on a Mac with an M1, M2, M3 or M4 chip, with exact commands, verification and fixes for the most common arm64 architecture errors.

Cómo instalar y usar Homebrew en Mac con Apple Silicon paso a paso
Como Instalar Y Usar Homebrew En Mac Con Apple Silicon Paso A Paso

If you have just unboxed a MacBook Air M3 or a Mac mini M4 and you are coming from the Linux world or from an Intel Mac, you are probably missing a decent package manager. That is where Homebrew comes in: the de facto standard for installing command-line tools and apps on macOS without wrestling with scattered installers.

In this tutorial I explain how to install it from scratch on a Mac with Apple Silicon (M1, M2, M3 and M4), what changes compared to Intel Macs, how to check that everything is working and how to fix the typical arm64 architecture failures. Allow about 10 minutes on the clock if your connection is decent.

What Homebrew Is and Why You Want It on an Apple Silicon Mac

Homebrew is an open-source package manager for macOS (and Linux) that lets you install software from the Terminal with a single command: brew install name. It covers everything from utilities like wget, git or ffmpeg to full applications with a graphical interface (so-called casks), such as Rectangle, VLC or Visual Studio Code.

On a Mac with an Apple Silicon chip, Homebrew runs natively on arm64, without going through Rosetta 2. That translates into faster binaries and lower power consumption. The default installation path also changes, and that is where many people get tangled up the first time.

Differences Between Homebrew on Intel Macs and Apple Silicon

The key difference is the installation directory:

  • Intel Mac: /usr/local
  • Apple Silicon Mac (M1/M2/M3/M4): /opt/homebrew

Apple reserved /opt/homebrew for arm64 builds precisely so that you can coexist with an Intel installation running under Rosetta if you need one. In practice: if your Mac is Apple Silicon, forget about /usr/local. Everything goes to /opt/homebrew.

This also affects the PATH: you need to add /opt/homebrew/bin manually in some shells, something that was not necessary on Intel because /usr/local/bin was already included by default.

Prerequisites Before Installing Homebrew

Before launching the installer, check the following:

  • macOS Monterey 12 or later (macOS Sonoma 14 or macOS Sequoia 15 recommended).
  • Xcode Command Line Tools installed. If you do not have them, the Homebrew installer will download them itself, but you can get ahead of it.
  • A stable internet connection (the installer downloads several hundred MB).
  • Administrator permissions on your user account.

To install the Command Line Tools yourself, open Terminal and run:

xcode-select --install

A pop-up window will appear. Accept and wait for it to finish (5-15 minutes depending on your connection).

How to Open Terminal on macOS

Three quick ways:

  1. Spotlight: press ⌘ + Space, type "Terminal" and press Enter.
  2. Launchpad: the Other folder → Terminal.
  3. Finder: Applications → Utilities → Terminal.

If you prefer a more modern alternative, iTerm2 or Warp work perfectly with Homebrew. For this tutorial, use the native Terminal, which is enough.

Installing Homebrew Step by Step on a Mac with Apple Silicon

Step 1: Run the official installation command

In Terminal, paste this command (it is the official one, published on brew.sh):

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

Press Enter. The script will explain what it is going to install and in which paths. Review it before continuing.

Step 2: Enter the administrator password

It will ask for your user password (the same one you use to log in). Type it and press Enter. You will not see any characters as you type; this is normal for security reasons.

Step 3: Wait for the download and installation

The process takes between 3 and 10 minutes. You will see it download the Command Line Tools if you were missing them, clone the main repository and set up permissions in /opt/homebrew.

When it finishes, an Installation successful! message will appear, followed by two lines under the heading Next steps. Copy them: you need them right away.

Step 4: Add Homebrew to the PATH

This is the step most people skip and then wonder why brew does not work. On an Apple Silicon Mac with zsh (the default shell since macOS Catalina), run:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

The first line adds Homebrew to your shell startup. The second activates it in the current session without closing Terminal.

If you use bash instead of zsh, replace ~/.zprofile with ~/.bash_profile.

Step 5: Verify the installation with brew doctor

Close Terminal and open it again. Run:

brew doctor

If everything is fine, you will see: Your system is ready to brew.

Also check the version:

brew --version

It should show something like Homebrew 4.4.x.

Basic Homebrew Commands You Will Use Every Day

These are the ones you will know by heart within a week:

Command What it does
brew install <package> Installs a CLI tool
brew install --cask <app> Installs an app with a GUI
brew uninstall <package> Uninstalls a package
brew list Lists everything you have installed
brew search <term> Searches for available packages
brew info <package> Shows details and dependencies
brew update Updates the Homebrew index
brew upgrade Updates the installed packages
brew cleanup Deletes old versions and cache

A real example: to install git, wget and Visual Studio Code in one go:

brew install git wget
brew install --cask visual-studio-code

How to Update Packages with brew

Recommended routine once a week:

brew update && brew upgrade && brew cleanup
  • brew update refreshes the list of available formulae.
  • brew upgrade updates everything you have installed to the latest version.
  • brew cleanup frees up space by deleting old versions.

If you only want to update one specific tool:

brew upgrade git

How to Install Apps with Homebrew Cask

Casks are apps with a graphical interface: browsers, editors, utilities. They are installed just like regular formulae but adding --cask:

brew install --cask rectangle
brew install --cask iterm2
brew install --cask spotify

The app will appear in /Applications as if you had installed it from the .dmg. Advantage: you update it with brew upgrade along with everything else, without downloading installers by hand.

Common Problems When Installing Homebrew on Apple Silicon

Error: "command not found: brew"

The most common one. It means you have not added Homebrew to the PATH. Run again:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Close and reopen Terminal.

Error: "bad CPU type in executable"

You are trying to run an Intel binary on an Apple Silicon Mac without Rosetta 2. Install it with:

softwareupdate --install-rosetta --agree-to-license

Even so, the best approach is to use the native arm64 formula whenever one exists.

Permission error on /opt/homebrew

If you get Permission denied, fix the folder permissions:

sudo chown -R $(whoami) /opt/homebrew

This command uses sudo: it will ask for your password and change the owner of /opt/homebrew to your user. It is safe on your personal Mac.

Warnings when running brew doctor

Many warnings are informational and do not break anything. Read them calmly before touching anything. If it says Warning: Homebrew's "sbin" was not found in your PATH, add /opt/homebrew/sbin following the suggestion it shows you.

How to Uninstall Homebrew on Mac

If you want to start from scratch or leave your Mac clean:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

It removes the installation and all packages. Afterwards, delete the folder manually if any leftovers remain:

sudo rm -rf /opt/homebrew

Warning: sudo rm -rf is destructive. Double-check the path before pressing Enter.

Alternatives to Homebrew

It is not the only option, although it is the most widely used:

  • MacPorts: older, compiles from source code by default. Slower but very flexible.
  • Nix: a reproducible package manager with a steep learning curve. Interesting if you like functional programming.
  • Mac App Store + mas-cli: for official store apps from the Terminal.

For 95% of cases, Homebrew wins on community, speed and number of available packages.

Frequently Asked Questions

Does Homebrew work on macOS Sequoia 15?

Yes. Homebrew 4.x supports macOS Sequoia 15 without problems, on both Apple Silicon and Intel.

Can I install Homebrew without administrator permissions?

Not officially. The installer needs to create /opt/homebrew and adjust permissions, which requires sudo at least once.

Does Homebrew take up a lot of space?

The base installation is around 500 MB. Each package adds its own. With regular brew cleanup it does not get out of hand.

Can Homebrew be used on an iPad or iPhone?

No. Homebrew depends on macOS and a full Unix shell. iPadOS 18 and iOS 18 do not allow it.

Is it worth migrating from MacPorts to Homebrew?

If you come from MacPorts and it is working well for you, there is no rush. Homebrew has the advantage in the number of up-to-date packages and in community. Running both is possible but not advisable: pick one and stick with it.

JG

Jaime Gomez

Writes at DescubreApple. Topics: Hardware, Software, Industry. 234 articles published since 2006.

🇬🇧 EN