If you’re a fan of Mac articles and tutorials, then sooner or later you’re going to run into the term “Homebrew” – but what is Homebrew exactly?
In this article, I’m going to provide a complete introduction to Homebrew, including demystifying what Homebrew does, and why you need it in your life.
By the time you’ve completed this article you’ll have Homebrew up and running on your Mac, and will know how to use this powerful utility to download, compile and install a whole new ecosystem of macOS command line utilities.
What is Homebrew?
Although there’s no shortage of Mac apps available to download from the App Store and various third party websites, there’s also countless utilities that are primarily distributed as bundles of source code that you need to build yourself. In an ideal world, all macOS programs would be available in a ready-to-use format, but in reality some of the most innovative and cutting-edge programs are distributed in this “raw” source code form.
Homebrew is a package management system that can help you tap into this new world of utilities and apps, by taking the pain out of building programs from their source code.
You instruct Homebrew to install a package by typing a single command into the Terminal, and Homebrew will respond by performing all of the following:
- Downloading the package’s source code.
- Checking whether this particular project requires any dependencies that aren’t already installed on your Mac, and downloading any missing dependencies.
- Building your requested software, plus any additional dependencies.
- Installing the software, ready for you to use.
Homebrew uses Apple’s Xcode software to install some of its formulas, so if you don’t have the Xcode development environment installed on your machine, then you’ll need to install it before you can use Homebrew. The good news is that you can install Xcode with a single Terminal command:
- Launch your Mac’s Terminal application (‘Applications > Utilities > Terminal’).
- Type the following command into the Terminal window:
- Press the ‘Enter’ key on your keyboard.
- As soon as Xcode is installed, you can install Homebrew by running the following command in the Terminal:
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
- The Terminal will print some information about the directories it’s going to create. Check this information and if you’re happy to proceed, then press the ‘Enter’ key on your keyboard.
- When prompted, enter your admin password and then press ‘Enter’ again. Homebrew will now be installed – note that this may take a few minutes.
Once Homebrew is installed, Terminal will display an ‘Installation successful!’ message, but you can verify that Homebrew is installed correctly by running the following Terminal command:
If this returns “Homebrew” followed by a version number, then you’ll know that Homebrew is installed and is now ready for you to use.
Installing packages with Homebrew
To install a package via Homebrew, you simply need to type the “brew install” command, followed by the formula name for the package you want to install.
A formula communicates important information to Homebrew, including where it can find this particular piece of software, where it should install each file, and any dependencies that this project requires.
In this section, I’m going to show you how to install speedtest-cli, a simple utility that lets you check the speed of your Internet connection from the Terminal window, but the steps will be largely the same regardless of the project you want to download.
To install speedtest-cli, simply enter the following command into the Terminal:
brew install speedtest_cli
Homebrew will then download, build and install speedtest-cli. Once speedtest-cli is up and running, you can test the speed of your Internet connection by running the following command in the Terminal:
If you’ve heard about a useful program but aren’t sure about its formula name, then you can usually find this information by performing a Homebrew search. Simply type “brew search” into the Terminal, followed by the name of the item you want to install, and then press the ‘Enter’ key – most of the time, this should return the correct formula name. For example, if you couldn’t remember the exact name of speedtest-cli but knew that it had “speedtest” in there somewhere, then you could enter the following command into the Terminal:
brew search speedtest
This would be enough to return “speedtest-cli” as the suggested formula name.
Getting a refresher
Whenever you install a new package, Homebrew displays some information about this project in the Terminal. However, chances are you won’t be able to recall this information word-for-word a few months down the line, so you can get a refresher at any time by typing the “brew info” command into the Terminal, followed by the package name. For example:
brew info speedtest-cli
Uninstalling packages with Homebrew
To uninstall a package using Homebrew, simply type “brew uninstall” into the Terminal, followed by the package name, for example:
brew uninstall speedtest-cli
Before you go
After spending over 20 years working with Macs, both old and new, theres a tool I think would be useful to every Mac owner who is experiencing performance issues.
CleanMyMac is highest rated all-round cleaning app for the Mac, it can quickly diagnose and solve a whole plethora of common (but sometimes tedious to fix) issues at the click of a button. It also just happens to resolve many of the issues covered in the speed up section of this site, so Download CleanMyMac to get your Mac back up to speed today.