How to Install Homebrew on a Mac

Homebrew is a package manager for MacOS that is one of the preferred tools for developers who want to streamline their deployment processes. Our expert explains how to install it.

Written by Alex Dionicio
Published on Jan. 11, 2024
How to Install Homebrew on a Mac
Image: Shutterstock / Built In
Brand Studio Logo

Homebrew is a package manager for MacOS (and Linux). This way, with a single line of code, users can install, update, and manage various applications and tools on their Macs. Its the go-to tool for developers and tech enthusiasts, ensuring a streamlined and efficient process for software deployment. 

More From Alex DionicioPandas concat() Function in Python With Examples

 

What Is Homebrew Used For?

Homebrew provides access to thousands of open-source software packages, including development tools, utilities, productivity apps and games. This opens up a whole world of possibilities for Mac users beyond the limited selection available in the App Store. Homebrew allows users to perform all those operations from the command line interface, making setting up and maintaining a development environment easier.

This package manager is a fantastic tool for both software developers and casual users alike. Its consumers can install tools for video editing, music production and graphic design to automate tasks like file manipulation, network management, and system configuration through Homebrew scripts. With the colossal number of packages available, the sky is the limit.

One thing to note when installing Homebrew is that its a text-based terminal application, so for optimal use, those looking to download the package manager must have a reasonable understanding of running commands on a terminal

This article will explain exactly how to download Homebrew, including some useful common commands, as well as how to uninstall. Lets get started. 

 

Prerequisites for Homebrew Installation 

Before getting into the Homebrew installation process, users need to take care of a bit of housekeeping. Your MacOS needs to match the following technical criteria:

Technical Criteria for Homebrew Installation

  1. Apple Silicon CPU or a 64 bits Intel CPU 
  2. MacOS Monterrey 12 (or higher) is best 
  3. Command line tools (CTL) for Xcode or Xcode
  4. Have the Bourne again shell (Bash) already installed
  5. Administrator privileges

 

Steps for Installing Homebrew 

To install Homebrew, take the following steps.

7 Steps to Install Homebrew

  1. Open the terminal.
  2. Install Homebrew.
  3. Enter your password.
  4. Follow the instructions.
  5. Wait for installation.
  6. Verify installation.
  7. Turn off analytics (optional).

 

1. Open the Terminal

Open the application terminal on your MacOS. You can find it using spotlight search (Cmd + Space, then type Terminal).

 

2. Install Homebrew

Copy and paste the following command into the terminal and then press Enter → 

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

 

3. Enter Your Password

Type in your user password. This is the same password you use to log in to your MacOS account. For a security measure, you wont be able to see the characters as you type them. 

 

4. Follow the Instructions

The installation script will prompt you to press Enter to continue. This is your opportunity to review the script to ensure it looks as you expected.

 

5. Wait for Installation

The installation process can take some time as it downloads and installs all the necessary files to set up the Homebrew directories. You will see various messages printed in the terminal window as Homebrew is downloaded and configured. 

Once complete, you should see a successful installation message appear. 

 

6. Verify Installation

You should see a message once the installation is complete; however, to verify the installation, type the command → # brew doctor

If your Homebrew installation has been successful, you will see this text: “Your system is ready to brew.”

 

7. Turn Off Analytics (Optional) 

Users should know that Homebrew gathers anonymous usage data about how its consumers interact with the package manager. You can turn this feature off, however. 

Homebrew explains this decision on its website

Homebrew is provided free of charge and run entirely by volunteers in their spare time. As a result, we do not have the resources to do detailed user studies of Homebrew users to decide on how best to design future features and prioritize current work. Anonymous analytics allow us to prioritize fixes and features based on how, where and when people use Homebrew.

If you would like to turn off analytics tracking, run the following command within the terminal → # brew analytics off

You can also check the status of the analytic data collection after turning off analytics by running the following command → # brew analytics

Step Up Your Development GameCLI Commands: An Introduction With Examples

 

Common Homebrew Commands

After installing Homebrew, you can get acquainted with the software. Here are some of the most common commands you will use.

 

Install a package

# brew install <package> 

Replace <package> with the name of the software or tool you want to install.

 

Update Homebrew

# brew update

This command updates Homebrew and its package database.

 

Upgrade installed packages

# brew upgrade 

As the command implies, this upgrades all installed packages to their latest versions.

 

Search for a package

# brew search <keyword>

Searches for packages related to the specified <keyword>.

 

Show information about a package

# brew info <package>

Displays information about the specified package, including dependencies and versions.

 

Uninstall a package

# brew uninstall <package> 

Uninstalls the specified package.

 

Check for issues

# brew doctor 

Diagnoses any potential issues with the Homebrew setup.

 

How to Uninstall Homebrew

Homebrew isnt for everyone, and theres a range of reasons for wanting to uninstall the software. These range from having glitches with the program to wanting to free up your storage to trying out a different package manager. More on that later.

So, if youve decided that Homebrew isnt for you, then follow these simple steps to uninstall it.

5 Steps to Uninstall Homebrew

  1. Open the terminal.
  2. Uninstall Homebrew.
  3. Confirm uninstallation.
  4. Wait for uninstallation.
  5. Verify uninstallation.

 

Open the Terminal

Open the Terminal application of your MacOS. You can find it using spotlight search (Cmd + Space, then type Terminal).

 

Uninstall Homebrew

Run the following command in the terminal and then press Enter →  

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

 

Confirm Uninstallation

The script will prompt you with on-screen instructions and ask for confirmation that you wish to uninstall Homebrew. 

Press “Y” on your keyboard if you wish to continue with the uninstall. Then, enter your user password. This is the password that you use to log in to your MacOS account.

 

Wait for Uninstallation

The script will proceed with the uninstallation process of Homebrew and its associated files. This step may take a few minutes.

 

Verify Uninstallation

Once the script finishes, you can verify the uninstallation by typing the following command and pressing enter → # brew doctor

If you have successfully uninstalled Homebrew, you should see a message indicating that Homebrew is no longer installed on your system.

Programming for Data Science16 Bash Commands Data Scientists Must Know

 

Alternatives to Homebrew

There are a variety of reasons why Homebrew wont be everyone's cup of tea when it comes to package managers. So here is a list of alternative programs on the market.

 

MacPorts 

MacPorts simplifies the installation of various open-source software on MacOS. It uses its own infrastructure and port system and tends to be more source-based than Homebrew.

 

Fink

Fink is another package manager for MacOS that provides access to a wide range of Unix tools and software. Its similar to MacPorts and offers both source-based and binary-based package installations.

 

Anaconda

Anaconda is a distribution of Python and R programming languages that includes a package manager. This is the trendy option in the data science and scientific computing communities. Although its not a general package manager like Homebrew, it is worth mentioning for Python users.

 

Nix

Nix is a powerful package manager that works across different Unix-like systems, including MacOS. It uses a functional and declarative approach to package management, allowing for reproducible environments.

Homebrew can transform your Mac into a development powerhouse. You can access a plethora of tools and libraries to code, build, and deploy your wildest creations. Good luck! 

Hiring Now
Pie Insurance
Fintech • Insurance • Machine Learning • Other • Analytics • Automation
SHARE