How to install Homebrew on Mac (Personal tips included)

360.2K views
8 min read

Just two years ago, I knew next to nothing about Homebrew, so I still remember the main issues and concerns I faced. In this tutorial, I'll describe how to safely install and uninstall Homebrew on Mac and suggest a few tools similar to Homebrew you could benefit from. In simple words, I promise!

What is Homebrew and how does it work? 

Homebrew installs the stuff you need that Apple didn’t” — this is how Homebrew creators describe it, and I agree. If you want a more informative definition, Homebrew is a free and open-source package manager for macOS, helping you install, update, uninstall, and manage developer tools like Python, Ruby, and Node.js on your Mac. 

Why do you need it? With Homebrew, you can benefit from tons of command line tools to automate your work. Best of all, they are all installed, uninstalled, and updated in one location on your Mac. Here are just a few examples of the useful tools you can get through Homebrew:  

  • imagemick to convert images to other formats 
  • archey to share the localhost with your team 
  • hub for a better experience with Git 
  • tldr for practical examples on how to use the command line

To go easy on the coding jargon, I won’t be explaining how Homebrew works under the hood. The main thing you should know as a user is that Homebrew acts through Terminal commands — you can install, update, and uninstall packages by typing a few words. There are some simple default brew commands for installing single-file utilities and more advanced subcommands called casks — you’ll have to use those to install multi-directory utilities.

Requirements to install Homebrew on Mac  

Before you dive into the process, make sure your macOS meets the following requirements: 

  • Apple Silicon or 64-bit CPU 
  • macOS Monterey (12) or later
  • Bourne-compatible shell (bash or zsh syntax) 
  • Xcode’s command line tools (I'll explain how to install the tools in the following section)

More tools like Homebrew for Mac

If you already feel confused…That’s normal. The command line is tough. If you want a simpler solution, I recommend looking into Setapp. It’s a subscription service that gives you access to 250+ macOS and iOS tools for development, working with media files, design, and so on. Here are just a few:

  • Gitfox. If you use Homebrew to connect to repositories, you’ll love Gitfox. Not only is it a better alternative to Homebrew’s hub command, Gitfox makes the whole process of working with Git smarter. You can use this app to improve the quality of your code and commit faster. 

gitfox

  • DevUtils. It gives you access to a huge set of dev tools. From formatting JSON to debugging a JWT token, you can do all that locally on your Mac, without an internet connection.

devutils

The beauty of Setapp is that you don’t have to know the names of these apps or their full functionality — you just type your task in search (for example, “code”), and Setapp gives you apps that can help you with coding. It’s that simple.  

How to install Homebrew on Mac

Moving to the main part — ”install Homebrew Mac” — I should explain that the installation method I describe uses curl to download the installation script. This method is the easiest and it’s recommended by the Homebrew team. The same applies to the process of uninstalling Homebrew. Since some people don’t want to use curl for security reasons, there are ways to manually download and execute the script (but I won’t go into that here). 

Step 1: Install command line tools for Xcode

Xcode is Apple’s native IDE, an integrated development environment that has all the tools you need for software development on Mac. To install some of the Homebrew package components, you need to install Xcode’s command line tools first (in case you haven’t done it before). 

Here’s how to install command line tools for Xcode:  

  1. Open Terminal and type the following command: xcode-select --install.
  2. In the new dialog window, confirm you want to install the Xcode tools.
  3. Agree to a license agreement and wait for the installation process to complete. It might take a while. 
install homebrew xcode

Step 2: Install Homebrew on Mac 

Now your Mac is ready for Homebrew. Here’s the full installation process: 

  1. Open Terminal and type the following command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)".

  2. Type your admin password (note that you won’t see your keystrokes in the Terminal window — it’s a security measure) > hit Return.

  3. Wait a few minutes until you see the “Installation successful” message in Terminal.

Step 3: Turn off analytics 

This is not an obligatory step, but I'd better warn you that Homebrew can share some of your data with developers since the tool is free and open-source. Here’s what’s typically collected: Homebrew User Agent, Google Analytics version, Homebrew analytics tracking ID, Homebrew analytics user ID, and data about the status of Google Analytics anonymous IP setting. 

If you don’t want your data to be collected and shared with the Homebrew developers, here’s the command you should run in Terminal to turn off analytics: brew analytics off.

Step 4: Set up Homebrew

In Terminal, run brew help to get started. You’ll see examples of commands that will help you install different software, configs, and updates through Homebrew. For example, to install a package, you should type brew install ‘package name’ in Terminal. There are also a few useful troubleshooting commands you should take note of, such as brew doctor to detect installation issues.   

setup homebrew

Step 5: Update Mac Homebrew 

Anything you install via Homebrew needs to be updated regularly. You should also update the package manager occasionally to make sure it works properly, and you’re not missing some important new features:  

  • To update Homebrew, run brew update in Terminal.
  • To find out what packages need updating, run brew outdated in Terminal.
  • To update a specific package, run brew update package name in Terminal. 

How to uninstall Homebrew from Mac 

If you haven’t found much value in the Homebrew Mac tools, you can easily uninstall the package manager through Terminal. 

  • Here’s the command you should run to uninstall Homebrew on macOS Big Sur, Mojave, Catalina, and later:  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)".
  • Here’s the command you should run to uninstall Homebrew on macOS High Sierra, Sierra, El Capitan, and older: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)".

uninstall homebrew mac

You’ll be warned about the Homebrew files that will be deleted from your Mac. 

How to uninstall Homebrew packages from Mac 

If you don’t want to get rid of the package manager itself — but rather remove specific packages — you can do that. Here’s how: 

  1. Make sure there are no dependencies between the package you want to delete and the ones that are in use by running the following command: brew deps package name.
  2. If you’ve found dependencies and decide to ignore them, type the following: brew uninstall --ignore-dependencies package name.
  3. To uninstall the package, run the command brew uninstall package name.

Homebrew leaves your Mac cluttered. Here’s how to fix it 

The most common problem with Homebrew is that once you start using it, versatile files and configs start piling up on your drive. This seems logical because the whole point of using Homebrew is to help you install some extra stuff on your computer. But the problem is Homebrew also generates a lot of clutter you don’t need. 

Every time you update a specific package or Homebrew itself, a copy of the old version is created. These copies don’t go anywhere — they just sit there, eating up your storage space. You can check how much space is occupied by old copies if you run the command brew cleanup -n in Terminal. The worst thing is it’s nearly impossible to delete all these leftovers by simply uninstalling Homebrew. 

CleanMyMac X is the app that can remove Homebrew completely, with all the files, directories, and copies associated with it. Just run a System Junk cleanup > Clean. Before you agree to delete the junk CleanMyMac X has found on your Mac, you can click on Review Details to make sure you don’t remove anything important. Spoiler: That won’t happen because CleanMyMac X is smart enough to remove only the clutter you don’t need.  

CleanMyMac uninstall Homebrew

If you want a more thorough cleanup, use the Smart Scan feature. It removes the clutter as well as detects malware and optimizes your Mac’s speed and overall performance. Whether you’re new to Mac or a pro user, CleanMyMac X will give you a moment of bliss. Imagine how much time and effort you save by never having to free up storage manually! 

Grab all the task solvers on Setapp

If you’re looking to improve your productivity and do more with a Mac, command-line package management is the right direction. Homebrew is one of the best free package managers that is relatively easy to use if you have some experience with Terminal. And if it’s not for you, you can work on boosting your work with tools like Gitfox and DevUtils.  

Gitfox and DevUtils are paid apps, but you can try them for free with a Setapp subscription. Setapp is a subscription service for macOS and iOS apps. It is free for 7 days, then $9.99/month. 

FAQ

How to install Homebrew on Mac M1?

First, install command line tools for Xcode by running the command: xcode-select --install.

Then, install Homebrew by running this command in the terminal:

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

Where does Homebrew install on Mac?

On Intel Macs, Homebrew installs in the /usr/local/bin directory, requiring no additional configuration.

On Apple Silicon Macs (like Mac M1), Homebrew installs in the /opt/homebrew directory. This location is not included in the default $PATH, so you need to configure it by creating a ~/.zprofile file and adding the following line:

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

For more details, refer to Homebrew’s official documentation.

250+ apps for $9.99
per month

Sign up to Setapp and try them for free.

Security-tested