Homebrew is an open-source package manager for macOS that offers an easy way to install software and tools through the command line. If you are a coder, developer, Terminal lover, or more tech-savvy than an average Mac user, you can use Homebrew to simplify software installation on your Mac.
Homebrew lets you use commands to download and install Python, Ruby, MongoDB, PHP, Git, Node.js, cask, colordiff, Nmap, and other Unix command-line utilities. In this guide, I’ll show you how to install Homebrew on a Mac.
What is Homebrew?
Homebrew is an open-source package manager for Mac. You can use Homebrew to quickly find, install, and manage numerous command-line utilities and apps on your Mac. From its developers, “Homebrew is a software that installs the stuff you need, but Apple didn’t.”
Homebrew offers a vast collection of software packages that are easy to install, update, and uninstall using simple Terminal commands. This makes it ideal for those who need to frequently install software without jumping through hoops.
With Homebrew’s command-line interface, you can quickly install several developer tools like Python or open-source apps like Chromium-based web browsers that you use daily. It’s designed to be flexible, allowing you to completely customize the installation process to suit your specific needs.
Benefits of using Homebrew
- Homebrew can save you a lot of time. It automates downloading, compiling, and installing apps, eliminating the need to hunt down software installers and manually run installation procedures.
- Homebrew is easy to install and set up. You’re only required to execute a few simple commands in Terminal.
- Homebrew is an open-source tool that offers a centralized repository of software packages, making it easy to find the software you need.
- With Homebrew, you can easily choose which version of a software package to install and customize the installation.
- The program is designed to be secure and doesn’t require root access to install software, which helps eliminate security vulnerabilities.
Requirements to use Homebrew on Mac
Before you learn how to install Homebrew on Mac, let’s make sure your Mac matches the basic prerequisites for running the tool:
- CPU/Chipset: M1/M2/M3 series Apple Silicon or 64-bit Intel
- Operating System: macOS Big Sur 11 or later
- Command Line Tools (CLT): Xcode, Terminal
- Shell: Any Bourne-compatible shell like Bash, zsh, fish, etc.
How to install Homebrew on macOS M1/M2/M3
Homebrew relies on several dependencies to work, so you’ll have to download each of them. After that, the next step is fetching Homebrew from its GitHub repository.
Here’s the detailed five-stage process for installing Homebrew on Mac.
1. Install Xcode from the App Store
Xcode is a native Integrated Development Environment (IDE) in macOS that provides a set of tools for developers to use in creating software and building complex development systems, like compilers and debuggers.
Because Homebrew relies on Xcode, the first step is to download it from the App Store.
Note: It’s not mandatory to download Xcode to install Homebrew on a Mac. However, I still recommend doing so to ensure a smoother user experience.
- Launch the App Store → Search for Xcode → Click Get.
- Once the download finishes, open Xcode → Click Install.
- Then, click Continue to complete the installation.
You might be asked to pick the platform you’d like to develop for—choose macOS.
2. Install command line tools for Xcode
Once you install Xcode on your Mac, you also need to install command line tools for Xcode. These tools allow your Mac to accommodate some of the Homebrew package components.
- Open Terminal on your Mac using Launchpad or Spotlight search.
You can also open Terminal from Finder → Applications → Utilities. - Type
in the Terminal → Hit return.xcode-select --install
- When a prompt appears, click Install.
- Go through the License Agreement, then click Agree.
- If the Mac is not connected to power, you’ll be prompted to do so. You may click Continue on Battery Power If your Mac’s battery is at 50% or above.
- Once the Xcode command line tools are downloaded and installed, click Done.
3. Get Homebrew from its GitHub repository
Once you have Xcode and command line tools for Xcode ready, you can use the Terminal on your Mac to fetch Homebrew from its official GitHub repository.
While there are various Homebrew forks available out there, I’d highly recommend installing the original one to ensure maximum compatibility.
- Open Terminal on your Mac.
- Paste the below command into the Terminal window → Press return.
/
bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Now, enter your Mac’s password → Then, hit return to continue.
Note: You can’t see the password as it’s typed, but it gets recorded in the background. - Hit the return key again to continue.
- After running a few commands, your screen will display an Installation successful message.
4. Add Homebrew path
Once you finish installing Homebrew, you must add it to your Mac’s system path. This makes finding, installing, using, and managing software packages easier.
If you wish to skip this step, you can still use Homebrew without it. However, you’ll need to specify Homebrew’s installation directory every time you access it via the Terminal. We recommend avoiding this hassle since adding a system path makes things quite a bit easier.
- Open Terminal on your Mac.
- Paste the given commands one by one and hit return after each one.
cd /opt/homebrew/bin/
ls
PATH=$PATH:/opt/homebrew/bin
cd
touch .zshrc
echo export PATH=$PATH:/opt/homebrew/bin -> .zshrc
brew doctor
- After entering these commands, you’ll see a message that says, “Your system is ready to brew.”
That’s it! You can verify if Homebrew has been installed correctly and get moving!
5. Verify if Homebrew is installed correctly
After you finish installing Homebrew on your Mac, it’s recommended that you verify if Homebrew is installed correctly. Here’s how you can do this:
- Open Terminal on your Mac.
- Type
brew -v
into the Terminal window → Press Return.
If Homebrew is installed correctly, you’ll see a version number for it. - In case the last command didn’t work, type
brew doctor
→ Hit Return.
This command will scan the Homebrew installation for potential errors.
If you see brew -v and the Homebrew version, it means Homebrew has been installed properly. If you see the second error message, just follow the instructions and repeat the process.
How to install packages with Homebrew
This is where all the hard work pays off. Once Homebrew is successfully installed on your Mac, you can follow the steps provided below to quickly find and install the apps of your choice.
- Open Terminal on your Mac.
- Type
brew search (SearchTerm)
into the Terminal window.
Replace(SearchTerm)
with the package you’re looking for. Here, I have gone with Firefox. - Type
brew info (PackageName)
to retrieve details about a package.
Replace(PackageName)
with the name of the package. - Type
brew install (PackageName
) into the Terminal window.
Replace(PackageName
) with the name of the package. In my case, I’m installing the Firefox browser, so I’ve typed Firefox.
After you install software using Homebrew, it will automatically show up in the Launchpad. But If you want to access the downloaded packages (known as casks), you can find them under /opt/homebrew/caskroom in Finder.
How to uninstall packages with Homebrew
If you want to uninstall or delete specific packages or apps on your Mac, you can effortlessly do so by executing the following Homebrew command.
- Open Terminal on your Mac.
- Type
brew list
into the Terminal windows → Then press return.
This command will list down all the apps you installed via Homebrew. - Type
brew uninstall (PackageName
) into the Terminal window.
Replace(PackageName)
with the name of the package. In our case, we’re removing the Firefox browser, so we’ve typed Firefox.
How to turn off Homebrew analytics
Homebrew, while open-source, collects and shares analytical data with the developers to help them improve the tool. As a result, if you don’t want to contribute and share your data, you may turn off Homebrew analytics.
Remember that this step is optional, but I recommend you follow the steps given below and turn off analytics to keep your data safe and secure.
- Open Terminal on your Mac.
- Type
brew analytics off
into the Terminal window → Press Return.
How to update apps with Homebrew
Besides installing and uninstalling software packages, Homebrew also offers a convenient way to keep your apps updated. Here’s how you can do this:
- Open Terminal on your Mac.
- Type
brew outdated
into the Terminal window → Then, press return.
This command will list down all the apps that need to be updated. - Type
brew upgrade (PackageName
) into the Terminal → Press return.
Replace(PackageName
) with the name of the package.
The steps above can help you update individual apps. However, if you want to update all apps at once, you may type brew upgrade
→ Then hit return.
How to update Homebrew on Mac
Like any other app on your Mac, Homebrew also receives periodic updates with new features and refinements. Here’s how you can update Homebrew:
- Open Terminal on your Mac.
- Type
brew update
into the Terminal window → Press Return.
How to uninstall Homebrew on Mac
If you didn’t find Homebrew useful and want to remove it from your Mac, you may do so easily by following the quick instructions outlined below.
- Open Terminal on your Mac.
- Paste the given command into the terminal window → Press Return.
/bin/bash -c "$(curl fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
- Type y in the Terminal window → Then, press Return.
- Then, enter your Mac’s password.
After that, Homebrew will be uninstalled from your Mac.
Wrapping up…
Homebrew offers a seamless way to manage apps on Mac, regardless of whether you’re a developer, sysadmin, or regular user. If you want to install Homebrew on your Mac, the steps outlined in this guide can help. However, if you’re facing any difficulties, please let us know in the comments section.
Also, let us know what you think about Homebrew. Do you see yourself using it regularly, or you wouldn’t go through the hassle?
It’s not essential to install Homebrew on your Mac. However, Homebrew can be a valuable tool for quickly downloading applications and developer tools on your device without fiddling around in a web browser.
Yes, of course. In addition to installing developer tools like git, Homebrew can also be used to install apps with a graphical user interface. However, it’s recommended that you install the Homebrew cask to manage GUI applications efficiently.
Unless specified otherwise during the installation, Homebrew is typically installed at /opt/homebrew
(on Apple Silicon Macs) or /usr/local/bin
(on Intel Macs).
Yes. Homebrew can be installed on all M1/M2/M3 Apple Silicon and Intel Macs that support at least macOS Big Sur or later versions of macOS, such as Ventura and Sonoma.
You may also read:
- Most useful Terminal commands for macOS
- How to open a Mac app from an unidentified developer
- How to uninstall apps on Mac