How to Install and Use Homebrew on macOS to Manage Developer Packages

Managing software on macOS has historically been a fragmented experience. Unlike Linux distributions that come with powerful package managers built into the operating system, macOS relies primarily on the Mac App Store for consumer applications and manual downloads from developer websites for command-line tools and developer utilities. Homebrew fills this gap by providing a comprehensive, community-maintained package manager that allows you to install, update, and remove thousands of command-line tools, developer libraries, programming languages, and even full graphical applications directly from the Terminal. If you write code, manage servers, or work with any kind of development toolchain on a Mac, Homebrew is arguably the first utility you should install.

What Homebrew Actually Does

Homebrew manages software packages (called formulae for command-line tools and casks for graphical applications) by downloading pre-compiled binaries or source code, resolving dependencies automatically, and installing everything into a clean, isolated directory structure. This means:

  • You can install complex tools like ffmpeg, python, node, git, or postgresql with a single command.
  • All dependencies are handled automatically — if a tool requires a specific library, Homebrew installs it.
  • Updates are centralised — one command updates every installed package.
  • Uninstallation is clean — Homebrew tracks every file it installs and removes them completely.
  • Homebrew does not interfere with macOS system files. It installs everything into /opt/homebrew on Apple Silicon Macs and /usr/local on Intel Macs.

Prerequisites

Before installing Homebrew, ensure you have:

  • macOS 11 (Big Sur) or later — Homebrew supports the latest macOS versions and several prior releases.
  • Xcode Command Line Tools — These provide the compilers and headers Homebrew needs to build software from source. If they are not already installed, the Homebrew installer will prompt you to install them automatically.
  • An internet connection — Homebrew downloads packages from GitHub and its own binary cache.
  • Administrator access — You need to be able to use sudo during installation.

How to Install Homebrew

  1. Open Terminal (you can find it in ApplicationsUtilities, or search for it with Spotlight using Cmd + Space).
  2. Paste the following installation command and press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. The installer will explain what it plans to do and ask for your password. Enter your macOS user account password (the one you use to log in) and press Enter. The password characters will not appear on screen — this is normal Terminal behaviour.
  2. If Xcode Command Line Tools are not installed, the installer will download and install them automatically. This may take several minutes depending on your internet speed.
  3. Once the installation completes, the installer will display important instructions for adding Homebrew to your shell’s PATH. On Apple Silicon Macs, you typically need to run:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

This ensures that the brew command is available in every new Terminal session.

  1. Verify the installation by running:
brew --version

You should see the Homebrew version number printed in the Terminal.

Installing Your First Package

Homebrew uses simple, memorable commands. To install a package:

brew install <package-name>

For example, to install the popular code editor wget (a command-line file downloader):

brew install wget

Homebrew will download the package, resolve any dependencies, and install everything automatically. Once complete, you can immediately use wget in your Terminal.

Here are several commonly installed packages for developers:

PackageCommandPurpose
Gitbrew install gitVersion control system (newer than the macOS built-in version)
Node.jsbrew install nodeJavaScript runtime for server-side and build tools
Pythonbrew install pythonLatest Python 3.x with pip
FFmpegbrew install ffmpegAudio/video processing toolkit
htopbrew install htopInteractive process viewer (better than top)
jqbrew install jqCommand-line JSON processor
treebrew install treeDisplay directory structures as a tree
PostgreSQLbrew install postgresql@16Relational database server

Installing Graphical Applications with Homebrew Cask

Homebrew is not limited to command-line tools. The Cask extension allows you to install full macOS graphical applications — the same apps you would normally download from a website and drag into the Applications folder.

brew install --cask <app-name>

Popular cask installs include:

ApplicationCommand
Visual Studio Codebrew install --cask visual-studio-code
Google Chromebrew install --cask google-chrome
Firefoxbrew install --cask firefox
iTerm2brew install --cask iterm2
Docker Desktopbrew install --cask docker
Slackbrew install --cask slack
Notionbrew install --cask notion

This is significantly faster than manually visiting each developer’s website, downloading the installer, opening the DMG, and dragging the app to the Applications folder.

Updating Installed Packages

One of Homebrew’s greatest strengths is centralised updates. Instead of checking each application individually for updates, run:

brew update

This updates Homebrew’s internal index of available packages. Then:

brew upgrade

This upgrades all installed formulae and casks to their latest versions. To upgrade a specific package only:

brew upgrade <package-name>

To see which of your installed packages have updates available without actually upgrading them:

brew outdated

Removing Packages

To uninstall a package and remove all its files:

brew uninstall <package-name>

After uninstalling, you can clean up any leftover cached downloads and old versions:

brew cleanup

This frees disk space by removing outdated package downloads from the Homebrew cache.

Searching for Packages

To find a package by name or keyword:

brew search <keyword>

For example, brew search video will return all formulae and casks containing the word “video” in their name or description. You can also browse the complete catalogue at formulae.brew.sh.

Listing Installed Packages

To see everything Homebrew has installed on your system:

brew list

To see only formulae (command-line tools):

brew list --formula

To see only casks (graphical applications):

brew list --cask

Diagnosing Homebrew Problems

If something is not working correctly, Homebrew includes a built-in diagnostic tool:

brew doctor

This command checks your Homebrew installation for common issues — such as incorrect PATH configuration, outdated Xcode tools, or permission problems — and suggests fixes. Running brew doctor periodically is good practice, especially after macOS upgrades which can occasionally break developer toolchains.

Uninstalling Homebrew Completely

If you ever need to remove Homebrew and all packages it has installed:

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

This script removes the Homebrew installation directory and all installed packages. Your manually installed macOS applications and system files are not affected.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.