How to Install Homebrew on Mac (Apple Silicon) — The Missing Package Manager

Install and use Homebrew on Apple Silicon Macs (M1–M4). Covers setup, PATH configuration, installing packages like nmap, updating, and common troubleshooting.

Andreas · April 12, 2026 · 7 min read

Introduction

macOS ships without a package manager. Tools like nmap, wget, htop, and tree that come standard on Linux need to be installed manually. Homebrew fixes that — it's the de facto package manager for macOS, and it works natively on Apple Silicon (M1, M2, M3, M4).

If you followed our headless Raspberry Pi setup guide and tried to run nmap to find your Pi on the network, you may have hit "command not found." This article gets you set up.

Prerequisites

  • Mac with Apple Silicon (M1 or later) running macOS Ventura or newer
  • Terminal access (Terminal.app or iTerm2)
  • Admin password (Homebrew needs it once during install)

Step 1 — Install Homebrew

Open Terminal and paste:

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

The script explains what it will do and asks for confirmation. It installs Homebrew to /opt/homebrew on Apple Silicon (older Intel Macs used /usr/local).

Installation takes 1–3 minutes depending on your connection.

Step 2 — Add Homebrew to Your PATH

After installation, Homebrew prints two commands you need to run. They look like this:

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

This adds /opt/homebrew/bin to your PATH so the brew command works in every new terminal session.

Verify it worked:

brew --version

You should see something like Homebrew 4.x.x.

Step 3 — Install Your First Package (nmap)

Now install nmap — a network scanner useful for finding devices on your local network (like a Raspberry Pi):

brew install nmap

Homebrew downloads the pre-compiled bottle (binary) for Apple Silicon. Most packages install in under 10 seconds.

Verify:

nmap --version

Now you can scan your local network to find a Raspberry Pi:

nmap -sn 192.168.1.0/24

This sends a ping sweep across your subnet and lists every device that responds — including your Pi's IP address and hostname. See the full walkthrough in our headless Pi setup guide.

Essential Homebrew Commands

Command What It Does
brew install <pkg> Install a package
brew uninstall <pkg> Remove a package
brew list Show all installed packages
brew search <term> Search for available packages
brew update Update Homebrew itself
brew upgrade Upgrade all installed packages
brew info <pkg> Show details about a package
brew doctor Diagnose common issues
brew cleanup Remove old versions and cache

Step 4 — Install Useful Packages for Homelab Work

If you're working with Raspberry Pis and homelabs, these packages come in handy:

brew install nmap wget htop tree jq
Package What It Does
nmap Network scanner — find devices, open ports
wget Download files from the command line
htop Interactive process viewer (better than top)
tree Display directory structures visually
jq Parse and format JSON from APIs and configs

For SSH key management and remote Pi access:

brew install ssh-copy-id

This lets you copy your public key to a Pi in one command:

ssh-copy-id pi@192.168.1.42

Step 5 — Keep Everything Updated

Run this periodically (weekly is fine):

brew update && brew upgrade && brew cleanup

update fetches the latest package list, upgrade installs newer versions, and cleanup removes old cached downloads.

Check how much space Homebrew is using:

du -sh /opt/homebrew

A typical install with 10–20 packages uses 500MB–1.5GB.

Homebrew Casks — GUI Apps

Homebrew also installs desktop apps via "casks":

brew install --cask iterm2
brew install --cask visual-studio-code
brew install --cask raspberry-pi-imager

These install to /Applications just like drag-and-drop installs, but you can update them with brew upgrade --cask.

Apple Silicon vs Intel — What to Know

Homebrew on Apple Silicon installs to /opt/homebrew instead of /usr/local. This matters if you're following older tutorials that hardcode Intel paths.

If you need to check your architecture:

uname -m
  • arm64 = Apple Silicon (M1/M2/M3/M4)
  • x86_64 = Intel

Nearly all Homebrew packages now have native ARM bottles, so you rarely need Rosetta 2 translation. If a package lacks an ARM build, Homebrew compiles from source automatically — it just takes longer.

Troubleshooting

"command not found: brew" — The PATH wasn't set up. Run the eval command from Step 2, or add it to your ~/.zprofile manually and restart Terminal.

"Permission denied" during install — Make sure you own /opt/homebrew:

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

Slow installs — If Homebrew is compiling from source instead of downloading a bottle, you'll see ==> Building from source. This is normal for niche packages but shouldn't happen for common ones. Run brew doctor to check for issues.

"already installed" warning — Not an error. Use brew upgrade <pkg> if you want the latest version.

Packages conflict with system tools — Homebrew installs to /opt/homebrew/bin which appears before system paths. If you need the system version, use the full path (e.g., /usr/bin/python3).

Summary

Homebrew turns macOS into a proper development environment with one install command. For homelab work — scanning networks with nmap, managing Pi configs over SSH, downloading firmware — it fills the gaps that macOS leaves out of the box.

Related Tools

Comments