Quick Links

Key Takeaways

Install Homebrew on a Mac by running the following command in Terminal:

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

You can then run "brew install" to install software.

Homebrew is a package manager for macOS that allows you to install software using the "brew" command at the command line. It's easy to set up and simple to use once you're familiar with a few basic commands.

How to Install Brew on a Mac

To download Homebrew on a Mac, you just need to execute a few commands in a Terminal window. Homebrew works on both Apple Silicon (M1, M2, and so on) Mac models as well as older Intel-based machines.

To get started, launch Terminal (use Spotlight or find it under Applications > Utilities), then paste (or type) the following followed by the Enter key:

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

You'll be prompted for your admin password. Type it and then hit Enter to proceed.

Enter password to install Homebrew on macOS

Next, you'll be notified of what is about to be installed as part of the Homebrew setup process. This includes the Xcode Command Line Tools, which will be installed for you alongside other essential Homebrew components. Hit Enter to start installing Homebrew on macOS.

Hit Enter to install Homebrew on Mac

Now, you must wait for the various packages to download and install. How long this takes largely depends on your internet speed, but the whole thing should be over in around five minutes or so. Once the installation is complete, you'll be prompted to run two more commands.

Finish setting up Homebrew on macOS

First, run the following two commands to add Homebrew to your PATH:

echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile

eval $(/opt/homebrew/bin/brew shellenv)

If you don't run these two commands, you'll get a "command not found: brew" when trying to run Homebrew commands.

You can run brew update to make sure your list of available packages is up to date. Lastly, run the brew doctor command to make sure everything is working as advertised. Homebrew will list any issues and the commands you need to run to fix them.

How to Use Homebrew on a Mac

Use the "brew install name command to install applications on your Mac, replacing "name" with the name of the application you want to install. Homebrew can install both graphical applications (known as casks) and open-source command-line tools (known as formulae). For example, to install Firefox, you would run:

brew install firefox

If you're looking for a particular piece of software, you can search for it using the brew search command:

brew search google

You can find a list of all formulae and casks available on the Homebrew Formulae website.

Using the "brew search" command to find casks and formulae

You can limit your commands to just casks or formulae using the --cask or --formula options, for example:

brew search --formula apt

You can find a list of packages you have installed using the brew list command. Once you've found a package, you can get more information about what it does using the brew info command, including a description, any associated .APP files, the project homepage, and the current version:

brew info unofficial-wineskin

By default, Homebrew uses only the core directory of formulae, casks, and external commands. You may have to install some applications by "tapping" into another repistory using the brew tap command. Running this command on its own will list all currently tapped directories.

Using the "brew tap" command to list tapped directories

To remove an app you've installed using Homebrew, run the brew remove command (with or without --formula or --cask options), for example:

brew remove firefox

There are a lot more Homebrew commands and options that you can use, but these are the basics. For a full list of commands and additional options check out the Homebrew Documentation.

Why Homebrew Is So Useful on a Mac

Homebrew makes it possible to install applications with a single command, right from macOS Terminal. This removes the need to search for an app website, find a download link, download a .DMG or .PKG file, drag the .APP file into your Applications folder or run the .PKG, and dispose of whatever's left over.

Using brew search you can find applications based purely on their name and install them in a flash. It's also easy to keep these apps up to date, simply run the brew upgrade command to update everything, or limit the command to a specific cask or formula for example:

brew upgrade firefox

For open-source utilities, Homebrew is an all-in-one tool that can find, download, install, and maintain everything for you. It installs any other dependencies you may need for a utility to work, a tedious process that can otherwise require step-by-step installation.

Some of the most useful utilities (and their dependencies) can be installed in mere seconds with Homebrew, including Docker (docker), Node.js (node), Python (pyenv), Java (java), PostgreSQL (postgresql@15) and Npm (npm).

Searching for docker with brew on a Mac.

Frequently Asked Questions

What Is Homebrew on a Mac?

Homebrew is a free package manager that allows you to find, install, and maintain open-source utilities and graphical applications using simple text commands. The application can be installed and used entirely via the Terminal utility built into macOS.

How to Uninstall Homebrew on a Mac

You can remove Homebrew by downloading and running the uninstall script with the following command:

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

How to Add Homebrew to the Path on a Mac

This is covered in the final part of the Homebrew setup process. Once you've installed Homebrew the installer should prompt you to run two more commands, the first is:

echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile

And the second is:

eval $(/opt/homebrew/bin/brew shellenv)

How to Fix "brew command not found" on macOS

If you encounter a "command not found" error while attempting to run brew commands you've either not got Homebrew installed or you didn't run the final two commands as prompted during the setup process.

Don't remember installing Homebrew? Run the installer using the following command in Terminal:

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

Otherwise, run the final two commands so that macOS recognizes the brew command when you try and run it. The first is:

echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile

And the second is:

eval $(/opt/homebrew/bin/brew shellenv)

If you find formulae or casks in the Homebrew Formulae browser that won't show up when you run the brew search command, you might need to tap the core package list again. To do this, first run:

rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"

Now tap the core again manually using:

brew tap homebrew/core

Don't forget to run brew doctor if things aren't working properly for more guidance.

Where Is Homebrew Installed on a Mac?

Homebrew is installed in the /opt/homebrew directory on your Macintosh HD drive. You can get there by launching Finder followed by Go > Go to Folder (Command+Shift+G) and typing "/opt/homebrew" followed by Enter.

To find out where a specific package is installed, use the brew info command, for example:

brew info firefox

Can I Install Homebrew Without Xcode?

You don't need the full Xcode package to install Homebrew, just the Xcode Command Line Tools. These should be installed when you attempt to install Homebrew. Alternatively, you can install them yourself using the following Terminal command:

xcode-select --install

You Can Always Install Mac Apps the Old Fashioned Way

Homebrew is far from the only way to install Mac software. Installing software on a Mac is easy, whether you're using the Mac App Store, a downloaded .DMG file, or a .PKG installer. Once you've tried out an app, you can remove it using the Trash or a third-party app.