If you are making your first steps on macOS, you may have never heard of Homebrew before. Homebrew is a powerful package manager, similar to npm if you’ve worked with it before. It allows you to easily install, update, and remove software packages directly from your terminal, making it an incredibly handy tool for developers. In this post, you’ll find a step-by-step guide to install Homebrew on MacOS.

Why is it essential to install Homebrew?#

Homebrew is widely regarded as the most popular package manager for macOS. It’s the go-to choice for developers and power users because of its simplicity and active community support.

Homebrew lets you easily get the tools and libraries you need for development or daily tasks, from developer tools like Git and Node.js to simple everyday utilities. It saves time by skipping the trouble of manual downloads and setup. It’s simple, fast, and perfect for customizing your Mac.

If you haven’t used a tool like Homebrew before, don’t overlook it – it could completely transform the way you manage software on your Mac.

Check if Homebrew is already installed#

Just to make sure you haven’t already installed Homebrew in the past, let’s check it out. Open your terminal and type:

brew help

If you have it installed, you should see something like

Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  brew update
  brew upgrade [FORMULA|CASK...
  ....

otherwise, you will get the following result

command not found: brew

How to install Homebrew#

Ready to install Homebrew? Here’s everything you need to know. Open your terminal (Cmd + Space and typeTerminal“) and type

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

Oh, you say! What is this command? Let me explain. This command asks bash (which is a command-line shell language commonly used in macOS and Linux) to execute a script.

Here’s how it works:

  • /bin/bash: specifies the bash shell, ensuring the command is executed using bash, even if your default shell is something else (like zsh).
  • -c: This flag tells bash to execute the command provided in quotes.
  • $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh): This part fetches the Homebrew installation script directly from GitHub using curl (a tool for transferring data over the network — worth learning properly, since it turns up in install instructions like this one constantly).

In simple terms, this command downloads the Homebrew installer script from GitHub and immediately runs it using bash to set up Homebrew on your system.

You will be asked for your super user password:

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

Checking for `sudo` access (which may request your password)...

Password:

After typing your password, you’ll see a message prompting you to press ENTER to proceed with the installation. Simply press ENTER, and the installation will continue.

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

Checking for `sudo` access (which may request your password)...

Password:

==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
....
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
....
/opt/homebrew/Frameworks

Press RETURN/ENTER to continue or any other key to abort:

Wait for the installation process to complete—it may take a few minutes. Once it’s done, you’ll see the message “Installation successful!”. However, to ensure everything was installed correctly, let’s verify it by typing the following command in the terminal:

brew help

If it was successfully installed, you should see the following response.

Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  ....

Homebrew doesn’t work after installing it#

If you’ve already followed all the steps described to install Homebrew but see a “command not found” error when running, e.g., brew help it typically means that the Homebrew binary is not properly added to your system’s PATH.

To resolve the issue, revisit the logs from the Homebrew installation script. At the end of the script, you’ll typically find specific instructions for finalizing the installation.

Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!
...
...
...
==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:
    echo >> /Users/<your username>/.zprofile
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<your username>/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

copy the last part of the Homebrew installation instructions —starting from the command that begins with echo — and paste it into your terminal. This command typically adds Homebrew to your system’s PATH.

What Homebrew actually did to your Mac 🔍#

Worth thirty seconds, because it explains most of the confusion that follows.

Homebrew installs everything into a single directory it owns:

  • /opt/homebrew on Apple Silicon Macs (M1 and later)
  • /usr/local on older Intel Macs

Not sure which you have? Ask it:

brew --prefix

That difference is behind a genuinely large share of “this guide doesn’t work for me” moments — a tutorial written on an Intel Mac points at /usr/local, you paste the path on an M-series machine, and nothing is there.

Inside that directory, each package lives in its own folder, and Homebrew creates symlinks from bin into your PATH. That’s the whole trick: install once, get a command you can type, remove it cleanly later because nothing was scattered across your system.

It also explains why you don’t need sudo for day-to-day use. The prefix belongs to your user account, not to root. Never run sudo brew install — it creates root-owned files inside a directory Homebrew expects to own, and every later command spends its time complaining about permissions. The installer asks for your password once, at the start, to create that directory. After that, brew on its own is correct.

Formulae and casks: two kinds of thing 🍺#

Homebrew installs two different categories of software, and knowing the words saves you a search:

  • Formulae are command-line tools and libraries — git, node, postgresql, wget.

    brew install git
  • Casks are ordinary Mac apps with a window and an icon, the ones you’d normally download as a .dmg and drag into Applications.

    brew install --cask visual-studio-code

That second one is the part people miss for months. VS Code, Docker Desktop, Firefox — no download page, no drag-and-drop. And when you set up your next Mac, a handful of brew install --cask lines rebuild your whole toolkit while you make coffee.

The commands you’ll actually use#

Command What it does
brew search TEXT Find out whether a package exists
brew info FORMULA Version, dependencies and any caveats — read this one
brew install FORMULA Install it
brew uninstall FORMULA Remove it
brew list Everything you’ve installed
brew outdated What has a newer version available
brew update Update Homebrew itself and its catalogue
brew upgrade Update your installed packages
brew cleanup Delete old versions and reclaim disk space
brew doctor Check your setup for problems

brew update vs brew upgrade 🤯#

These two names are the single most confusing thing about Homebrew, so let’s be blunt about it:

  • brew update refreshes Homebrew’s list of available software. Nothing you installed changes.
  • brew upgrade installs newer versions of the packages you actually have.

Run update first, then outdated to see what’s coming, then upgrade:

brew update
brew outdated
brew upgrade

Skipping straight to brew upgrade still works — it updates the catalogue itself first — but you’ll have upgraded things without ever seeing what was about to change.

One habit worth forming: brew info before you install anything. That’s where a formula tells you it’s keg-only, or that it needs a line added to your shell config, or that it just created a database cluster somewhere. Those caveats are the difference between a tool that works and an hour of troubleshooting — the Postgres install is the classic example, since it prints exactly the brew services command you’ll need next.

Frequently asked questions#

Do I need Xcode to use Homebrew?#

Not the full Xcode, but you do need Apple’s Command Line Tools, which are a few gigabytes of compilers and developer utilities. The good news is the Homebrew installer handles this for you — if that step in your install took a suspiciously long time, that’s what it was doing.

How do I uninstall Homebrew?#

The project publishes an uninstall script alongside the installer:

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

Same shape as the install command, different filename. It removes Homebrew and everything it installed, so read what it prints before confirming.

Why does Homebrew say a package is “keg-only”?#

It means the package was installed but deliberately not linked into your PATH, usually because it’s a specific version of something that could conflict with another version. It isn’t an error. brew info on that package prints the export PATH line you need to use it.

What if brew doctor reports warnings?#

Don’t panic — brew doctor is thorough to the point of pessimism, and “Your system is ready to brew” is genuinely rare on a machine that’s seen some use. Read the warnings, fix anything mentioning permissions or an unexpected file in the prefix, and ignore the rest unless something is actually broken.

By now, you should have Homebrew installed on your system successfully. Congratulations! This is just the first small step on your exciting journey to mastering powerful tools and workflows as you grow your skills. If you’re exploring ways to automate parts of your development workflow next, you might find Git tools like Husky pre-commit hooks especially helpful.

Keep reading#