macOS is a Unix-based operating system. As such, it gives you a command-line and graphical interface to interact with its various services and programs on your Mac.
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 that without first installing a package manager.
This is where Homebrew comes in. It is one of the best package managers for Mac, with a wide selection of packages that allows you to effortlessly install and manage programs and utilities on your Mac 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 instructions for installing Homebrew on Mac.
What is Homebrew?
Homebrew is a macOS package manager that makes it easy to install, update, and remove various macOS programs and utilities on Mac. It’s free, open source, and accessible from the command line (also known as the Terminal app on macOS).
With 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 example, 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 (install, update and uninstall), which is useful when you want to install/update/uninstall multiple packages at once. Similarly, another benefit of Homebrew is that it removes all files associated with a program when you uninstall it to reduce clutter.
How to Install Homebrew on Mac
Homebrew is compatible with Intel and Apple Silicon CPUs. It’s easy to install on Mac and involves running a few simple commands within the Terminal app.
Home Brewing Requirements:
Before you dive into the installation process, make sure 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 any other)
Then 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 working on apps for any of these platforms, you’d already have Xcode installed on your Mac; in which case, you’ll also have Xcode’s command line tools and can therefore skip to the next step.
However, if you don’t have the Xcode command line tools on your Mac, here’s how to install them:
- Open the Terminal app.
- Enter the following command and press Return:
When prompted with a dialog box to confirm the installation, click 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 will see a confirmation box indicating that the software has been installed. If you want to confirm this, open Terminal and run:
If this returns a path, then the installation was successful. If not, you should go through the installation process again.
Step 2: Install Homebrew on Mac
Installing Homebrew involves running the Homebrew installation script. Open Terminal and use run this command to run 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 administrator password and press Return.
The Homebrew installer will now tell 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 will see the Installation successful! message in 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 the appropriate commands in Terminal.
Check out our Homebrew guide to learn how to use Homebrew to install, update, and uninstall packages on Mac.
Uninstall Homebrew on Mac
For some reason, if Homebrew isn’t working properly or you don’t want it on your Mac anymore, you can simply uninstall Homebrew from your Mac.
Uninstalling Homebrew on Mac is easy and requires you to run the Homebrew uninstall script. Open Terminal and run this command to run the Homebrew uninstall script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Get into Y and press Return when prompted to confirm the uninstall of Homebrew on your Mac.
Install and Manage macOS Packages on Mac Easily with Homebrew
Homebrew greatly simplifies installing, updating, and uninstalling 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 Trash to uninstall them. Instead, it allows you to run some simple commands in Terminal to perform the same operations. Thus allowing you to perform these operations without leaving the Terminal.
If you’re a developer and your job involves using a lot of command-line utilities, this guide should help you install and get Homebrew running smoothly on your Mac. And later, you should be able to use Homebrew to install new packages and update or uninstall existing ones on your Mac easily.
Did you find this article useful