Homebrew’s package manager is designed to be surprisingly simple, which often leads people to believe there isn’t much to manage beyond brew install and brew update.
Let’s see what’s actually installed on your system. Open your terminal and run:
brew list
This command will output a simple, alphabetical list of every formula (package) that Homebrew has installed and is currently linked into your system’s PATH.
For example, if you’ve installed git, node, and wget, your output might look like this:
git
node
wget
But wait, there’s more to see. brew list only shows what’s directly installed. Many packages have dependencies – other packages they need to function. Homebrew manages these for you, but they don’t always show up in the basic brew list output. To see everything, including dependencies that are installed automatically, use:
brew list --formula
This is functionally the same as brew list for formulas, but it’s good to know the explicit flag.
What about casks? Homebrew isn’t just for command-line tools; it also manages graphical applications installed via casks. To see those, run:
brew list --cask
This will show you applications like google-chrome, visual-studio-code, or firefox that you’ve installed through Homebrew Cask.
If you want to see everything installed by Homebrew, both formulas and casks, you can combine the flags:
brew list --formula --cask
Or, more simply, just brew list --all.
Let’s get a bit more granular. Sometimes, a formula might be installed but not linked into your PATH. This means the executables for that package won’t be directly accessible from your terminal unless you manually add their specific bin directory. To see these unlinked packages, use:
brew list --unlinked
This is useful if you’re trying to figure out why a command isn’t working even though you recall installing the package.
You can also check for specific packages. If you want to know if python@3.9 is installed, you can pipe the output of brew list to grep:
brew list | grep python@3.9
If it’s installed, you’ll see python@3.9 on a line by itself. If not, you’ll see nothing.
Homebrew keeps track of not just currently installed packages, but also older versions that might be available if you’ve run brew upgrade recently. These are often called "old versions" or "stale packages." To see how many old versions you have lying around, you can run:
brew list --versions
This command shows you the installed version number for each formula. For example:
git 2.43.0
node 20.10.0
wget 1.21.4
If you have older versions of git installed, it might show something like git 2.42.0 2.43.0.
To clean these up and free up disk space, the command is:
brew cleanup
This command removes old versions of installed formulas and casks, as well as old downloads. It’s a good practice to run it periodically.
The real power of brew list comes when you start combining it with other commands. For instance, if you want to quickly check the version of a specific installed package, say node:
brew list --versions node
This will output just the version(s) of node that are installed.
When you install a package, Homebrew also installs its dependencies. These are packages that the primary package needs to run. If you want to see all packages that are installed because they are dependencies of something else you explicitly installed, you can use:
brew list --dependents
This command can be a bit verbose, as it will list every package and then, on subsequent lines, list the packages that depend on it. It’s a good way to understand the interconnectedness of your installed software.
The brew list command is your primary tool for understanding the state of your Homebrew-managed software. It’s simple, direct, and reveals what’s actually present on your system, which is crucial for troubleshooting and managing your development environment effectively.
Once you’ve listed all your packages, the next logical step is often to see which ones might be outdated and ready for an upgrade.