What Homebrew is and why you need it

Homebrew is a package manager for macOS that lets you install command-line tools and software from your terminal instead of hunting for installers online. Once installed, you can type a single command like brew install node to download and set up Node.js, or brew install git to get Git — Homebrew handles the rest.

Most developers use Homebrew because it saves time, keeps software organized in one place, and makes updates straightforward. If you work with code, databases, or command-line tools, Homebrew becomes the fastest way to get what you need running.

Key Takeaways

  • Homebrew installation requires opening Terminal and pasting a single command that downloads and runs the installer script.
  • You need Xcode Command Line Tools installed first, which Homebrew will prompt you to install if you don't have them.
  • After installation, you verify Homebrew works by typing brew --version in Terminal to see the version number.
  • On Apple Silicon Macs (M1, M2, M3), Homebrew installs to a different location than Intel Macs, but the installation command is the same.

Before you start: what you need

You need a Mac running macOS 10.13 or later — that covers almost every Mac in use today. You also need an internet connection and the ability to open Terminal, which comes built into every Mac.

Homebrew will check for Xcode Command Line Tools during installation. If you don't have them, Homebrew will ask you to install them. This is a separate download from the full Xcode app and takes 10 to 15 minutes on a typical connection. You don't need the full Xcode application unless you're doing iOS or Mac app development.

The installation command

Open Terminal (find it in Applications > Utilities, or press Command + Space and type "Terminal"). Copy this entire line exactly as it appears:

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

Paste it into Terminal and press Enter. Terminal will show you what it's about to do and ask for your password — this is your Mac login password. Type it (you won't see the characters appear) and press Enter again. The installation runs automatically from there.

If Terminal asks you to install Xcode Command Line Tools, type y and press Enter. Let it finish — this can take 10 to 20 minutes depending on your internet speed and Mac model.

What happens during installation

Homebrew downloads its core files and creates a folder structure on your Mac. On Intel Macs, this goes into /usr/local/Cellar. On Apple Silicon Macs (M1, M2, M3, M4), it goes into /opt/homebrew/Cellar. You don't need to know these paths — Homebrew handles them automatically.

The installer also adds Homebrew to your PATH, which is the list of places your Mac looks for programs when you type a command. This means after installation, typing brew in Terminal will work from any folder.

Verifying the installation worked

After the installer finishes, close Terminal and open it again. Type this command:

brew --version

Press Enter. You should see output like Homebrew 4.0.1 (the version number changes as Homebrew updates). If you see this, Homebrew is installed and ready to use.

If Terminal says "command not found", the PATH wasn't set correctly. Close Terminal, open it again, and try the command once more. If it still doesn't work, you may need to add Homebrew to your PATH manually — run echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile on Apple Silicon or echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile on Intel, then close and reopen Terminal.

Installing your first package

Once Homebrew is working, you can install software. For example, to install Git, type:

brew install git

Homebrew downloads the latest version and installs it. You can then use Git immediately by typing git in Terminal. To see what you've installed, type brew list. To update all your packages, type brew upgrade.

Troubleshooting common problems

If the installation command fails with a network error, check your internet connection and try again. If it fails with a permission error, make sure you typed your Mac password correctly when prompted.

If you see a message about Xcode Command Line Tools failing to install, try installing them separately. Open Terminal and type xcode-select --install, then follow the prompts. Once that finishes, run the Homebrew installation command again.

On Apple Silicon Macs, some older packages may not work yet because they were written for Intel processors. Homebrew can run Intel versions through an emulation layer called Rosetta, but this is slower. Most popular packages now have native Apple Silicon versions, and Homebrew installs the right one automatically.

Frequently Asked Questions

Do I need Xcode to use Homebrew?

No. You need Xcode Command Line Tools, which is much smaller and installs automatically if you don't have it. The full Xcode application is only necessary if you're developing apps for iPhone or Mac.

Is it safe to paste that command into Terminal?

Yes. The command downloads a script from Homebrew's official GitHub repository and runs it. You can read the script yourself before running it by visiting the URL in the command, but it's the official Homebrew installer used by thousands of developers.

Can I uninstall Homebrew if I change my mind?

Yes. Open Terminal and type /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/uninstall/HEAD/uninstall.sh)". This removes Homebrew and all packages you installed with it. Your other Mac software is unaffected.

What's the difference between brew install and brew cask?

brew install gets command-line tools and libraries. brew install --cask gets graphical Mac applications like Firefox or Slack. Both use Homebrew, but they install different types of software.

How do I update Homebrew itself?

Homebrew updates itself automatically most of the time. If you want to force an update, type brew update. To update all your installed packages, type brew upgrade.