However, unlike Linux, which comes pre-installed with a package manager, Apple’s macOS doesn’t have one. Ergo, if you want to install new programs or utilities on your Mac via the CLI, you can’t do it without installing a package manager first. This is where Homebrew comes in. It’s one of the best package managers for Mac, with a broad selection of packages that allows you to install and manage programs and utilities on your Mac effortlessly from the CLI. If you’re wondering how to get Homebrew on your Mac, here’s a guide to give you a quick overview of Homebrew, along with the instructions to install Homebrew on Mac.
What is Homebrew?
Homebrew is a macOS package manager that facilitates the installation, updation, and deletion of various macOS programs and utilities on Mac. It’s free, open-source, and accessible from the command line (aka the Terminal app on macOS). Using Homebrew, you can install, update, uninstall and manage various CLI and GUI software and utilities on your Mac with the help of a few simple commands. For instance, you can use Homebrew to install CLI tools like Git, Hexedit, Emacs, Vim, etc., along with GUI-based programs like Atom, Chrome, Bitwarden, etc. One of the biggest advantages of using Homebrew is bulk package operation (installation, updation, and uninstallation), which comes in handy when you want to install/update/uninstall multiple packages at once. Similarly, another benefit of Homebrew is that it removes all the files associated with a program when you uninstall it to reduce clutter.
How to Install Homebrew on Mac
Homebrew is compatible with both Intel and Apple Silicon CPUs. It’s easy to install on Mac and involves running a few simple commands inside the Terminal app.
Homebrew Requirements:
Before you dive into the installation process, ensure your Mac has:
64-bit Intel or Apple Silicon CPU macOS Catalina (1.0.15) or higher Xcode Command Line Tools Shell (bash, zsh, or or any other)
Next, follow the steps below to install Homebrew on your Mac.
Step 1: Install Xcode Command Line Tools
Xcode is a macOS IDE that allows you to create macOS, iOS, iPadOS, watchOS, and tvOS apps. If you’re a developer who works on apps for any of these platforms, you’d already have Xcode installed on your Mac; in which case, you’ll also have the Xcode Command Line Tools and can, therefore, skip to the next step. However, if you don’t have Xcode Command Line Tools on your Mac, here’s how to install it: When prompted with a dialog box to confirm the installation, click on the Install button. This may take a while, depending on your internet speed, to download and install the Xcode Command Line Tools. Once the installation is complete, you’ll see a confirmation box stating that the software was installed. If you wish to confirm this, open the Terminal and run: xcode-select -p
If this returns a path, it means the installation was successful. If it doesn’t, you need to go over the installation process again.
Step 2: Install Homebrew on Mac
Homebrew installation involves running the Homebrew installation script. Open the Terminal and use run this command to execute it on your Mac: /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" When prompted to enter the password, enter your admin password and hit Return.
Homebrew installer will now inform you which directories will be created as part of the installation. Press Return to continue, and it will start downloading and installing Homebrew.
Sit back and wait for the installation process to finish. Once installed, you’ll see the Installation successful! message in the Terminal. With Homebrew installed, you can now use it to find and install various macOS programs and utilities on your Mac. Additionally, you can also update and uninstall packages using appropriate commands in the Terminal. Check out our Homebrew guide to learn how to use Homebrew for installing, updating, and uninstalling packages on Mac.
Uninstalling Homebrew on Mac
For some reason, if Homebrew isn’t working properly, or you no longer want it on your Mac, you can simply uninstall Homebrew from your Mac. Uninstalling Homebrew on Mac is easy and requires you to run the Homebrew uninstallation script. Open the Terminal and run this command to execute the Homebrew uninstallation script: /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" Enter y and press Return when prompted to confirm the uninstallation of Homebrew on your Mac.
Install and Manage macOS Packages on Mac Easily With Homebrew
Homebrew greatly simplifies the installation, updation, and uninstallation of macOS programs and utilities on Mac. It eliminates the need to download and run an installer to install programs or manually move the app to the bin to uninstall them. Instead, it allows you to run a few simple commands in the Terminal to perform the same operations. Thus, allowing you to perform these operations without leaving the Terminal. If you’re a developer and your work involves using a lot of command-line utilities, this guide should help you install and get Homebrew running on your Mac smoothly. And subsequently, you should be able to use Homebrew to install new packages and update or uninstall the existing ones on your Mac easily.
Further Reading:
How to Install Mac Apps in Bulk Using macapps.link How to Set the PATH Variable in macOS How to Install and Use Wget on Mac and Windows How to Install and Configure Git on a Mac
On Intel-powered Mac: /usr/local/bin On Apple Silicon-powered Mac: /opt/homebrew/bin
brew –version