Keep Homebrew Tidy With `brew leaves`

nelsonfigueroa

Nelson Figueroa

Posted on January 23, 2024

Keep Homebrew Tidy With `brew leaves`

Homebrew has a brew leaves command that shows all installed packages with no dependencies. That means that they can be uninstalled without causing issues to other installed Homebrew packages. It’s good to regularly run this command to keep Homebrew from getting too bloated.

Here’s what my brew leaves output looks like at the time of this writing:

$ brew leaves

automake
bat
black
coreutils
ffmpeg
go
htop
hugo
jq
libksba
libpq
libtool
libyaml
node
openssl@1.1
pkg-config
postgresql@14
python-typing-extensions
tldr
tree
yt-dlp
zlib
Enter fullscreen mode Exit fullscreen mode

In my case, I know I don’t need the libpq package anymore. So I can remove this package and then run brew leaves again to confirm it’s gone.

$ brew remove libpq

Uninstalling /opt/homebrew/Cellar/libpq/16.1_1... (2,380 files, 29.9MB)
Enter fullscreen mode Exit fullscreen mode
$ brew leaves

automake
bat
black
coreutils
ffmpeg
go
htop
hugo
jq
libksba
libtool
libyaml
node
openssl@1.1
pkg-config
postgresql@14
python-typing-extensions
tldr
tree
yt-dlp
zlib
Enter fullscreen mode Exit fullscreen mode

And now libpq is gone! Try out brew leaves yourself. You may be surprised at the amount of things installed that you may not actually need.

💖 💪 🙅 🚩
nelsonfigueroa
Nelson Figueroa

Posted on January 23, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related