Mac Apps

How to install and use Homebrew

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.

Installing Homebrew

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:

xcode-select –install

  • 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:

brew –version

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:

speedtest-cli
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.

mac-pc

About the author

Chris

I've been a passionate evangelist for Apple and the Macintosh throughout my working life, my first love was a Quadra 605 working with a small creative agency in the south of Norfolk UK in the mid 1990's, I later progressed to other roles in other Macintosh dominated industries, first as a Senior graphic designer at a small printing company and then a production manager at Guardian Media Group. As the publishing and printing sector wained I moved into Internet Marketing and in 2006 co-founded blurtit.com which grew to become one the top 200 visited sites in the US (according to Quantcast), at its peak receiving over 15 million visits per month. For the last ten years I have worked as an Affiliate and Consultant to many different business and start ups, my key skill set being online marketing, on page monetisation, landing page optimisation and traffic generation, if you would like to hire me or discuss your current project please reach out to me here.

You can also follow me on: and

Add Comment

Click here to post a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.