Homebrew Cheat Sheet

I often go for months without installing anything on my Mac, so when the need to install something finally does arise, I discover I have forgotten most of what I ever learned about Homebrew.

So, here are the top ten things I need to remember about Homebrew, all in a short post.

1. Casks/Formulae

First things first. Casks and formulae are variations of things you can install via Homebrew (which you can read more about here). But for the sake of brevity, rather than repeating casks and formulae ad nauseam throughout this post, I will take a page from the main Homebrew website, and just refer to either/both as stuff.

2. Installing Homebrew

The need to install Homebrew happens least frequently of all the command, perhaps once every three years or so. And this way of installing always feels a little spooky compared to the 'normal' way of installing things on a Mac.

$ /bin/bash -c "$(curl -fsSL"

Follow the prompts, run the commands as requested, then check it:

$ brew --version
Homebrew 4.3.5

3. Updating/Upgrading

If you're used to using other package management systems like yum or aptitude, then updating/upgrading work as you would expect:

~ $ brew update
~ $ brew upgrade

4. Installing Stuff

~ $ brew install php
~ $ brew install php@8.2

Here I am installing two versions of php.

You might be wondering how I knew what versions of php were available to install?

5. Searching/Listing

To search for stuff that is available to install:

~ $ brew search php

Conveniently, Homebrew displays a check-mark in the search results next to the stuff that has already been installed.

Or, to list stuff that has been installed:

~ $ brew list

You can also check which versions of stuff have been installed:

~ $ brew ls --version | grep '^php[ @]'
php 8.3.8
php@8.2 8.2.20
~ $

Note above that ls also works for list.

6. Package Info

A handy command to repeat the instructions given at installation:

~ $ brew info php

7. Removing

To remove something that you have previously installed, either of the following commands work:

~ $ brew remove php
~ $ brew uninstall php

You will likely have to clean up directories after uninstalling, but Homebrew usually gives handy instructions in that regard.