As a programmer who uses macOS, I greatly appreciate Homebrew, the βMissing Package Manager for macOSβ.
I just learned about the brew leaves
subcommand and was glad to discover it.
Hereβs a bit about how and why Iβm using it.
This may be neurotic, or it may be some PTSD from when I used Arch Linux for a few years, but I try to upgrade all of my homebrew-managed dependencies regularly.
Hereβs how I do it.
First, I tell homebrew to phone home and update its local list of packages, which it can use to tell if any of my locally-installed packages have updates:
$ brew update
Then I ask homebrew to list out which packages have updates available, if any:
$ brew outdated
Then, typically, Iβll upgrade all of them1:
$ brew upgrade
Very often Iβll find that some of my outdated packages have names that I do not recognize. There are only about 30 packages that I explicitly install2, but most of those have dependencies which end up getting installed too, so I end up with way more than 30 packages total β more like 138.
For example, I use vim, and vim has several dependencies that homebrew installs when it installs vim:
$ brew deps vim --tree
vim
βββ gettext
βββ lua
βββ ncurses
βββ perl
β βββ berkeley-db
β β βββ openssl@1.1
β β βββ ca-certificates
β βββ gdbm
βββ python@3.11
β βββ mpdecimal
β βββ openssl@1.1
β β βββ ca-certificates
β βββ sqlite
β β βββ readline
β βββ xz
βββ ruby
βββ libyaml
βββ openssl@1.1
β βββ ca-certificates
βββ readline
Wow, look at all of those! So, because I installed vim, I also necessarily installed 15 other packages, and Iβll be updating all of them as time goes on.
When homebrew tells me that, for example, xz is outdated, a few questions enter my mind:
- what the heck is that?
- ok, itβs surely a dependency of something, but what is it a dependency of?
- is it possible that itβs actually not even necessary to have installed any longer? Maybe it was a dependency of something that I later uninstalled, but it just lingered aroundβ¦
Answering all of those questions is possible, but I didnβt actually know how to answer them until today. Letβs take them one-by-one.
What the heck is that?
To answer this, we can use brew info
:
$ brew info xz
==> xz: stable 5.4.1 (bottled)
General-purpose data compression with high compression ratio
https://tukaani.org/xz/
/opt/homebrew/Cellar/xz/5.4.1 (95 files, 1.7MB) *
Poured from bottle on 2023-01-16 at 04:20:15
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/xz.rb
License: Public Domain and LGPL-2.1-or-later and GPL-2.0-or-later and GPL-3.0-or-later
==> Analytics
install: 456,730 (30 days), 2,613,650 (90 days), 7,814,033 (365 days)
install-on-request: 22,257 (30 days), 150,853 (90 days), 422,948 (365 days)
build-error: 44 (30 days)
Which⦠sure, whatever. Sounds important.
What is this a dependency of?
This is a slightly tricky thing to answer.
As far as I can tell, thereβs no command such as brew why xz
that could simply answer why is it installed (please get in touch if Iβm mistaken).
What we can do is use the brew deps
command to describe the relationships between packages, and then search through it to see exactly why it is installed.
For me, that prints out 1,580 lines of output, which Iβll share in full behind a collapsible details widget here:
Full output of brew deps --full-name --installed --tree
(click to expand)
aom
βββ jpeg-xl
β βββ brotli
β βββ giflib
β βββ highway
β βββ imath
β βββ jpeg-turbo
β βββ libpng
β βββ little-cms2
β β βββ jpeg-turbo
β β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ openexr
β β βββ imath
β βββ webp
β βββ giflib
β βββ jpeg-turbo
β βββ libpng
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ libvmaf
autoconf
βββ m4
bash
bat
bdw-gc
berkeley-db
βββ openssl@1.1
βββ ca-certificates
indirect/tap/bpb
brotli
ca-certificates
cairo
βββ fontconfig
β βββ freetype
β βββ libpng
βββ freetype
β βββ libpng
βββ glib
β βββ pcre2
β βββ gettext
βββ libpng
βββ libx11
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ xorgproto
βββ libxcb
β βββ libxau
β β βββ xorgproto
β βββ libxdmcp
β βββ xorgproto
βββ libxext
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ xorgproto
βββ libxrender
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ xorgproto
βββ lzo
βββ pixman
cloc
ctags
emacs
βββ gnutls
β βββ ca-certificates
β βββ gmp
β βββ libidn2
β β βββ libunistring
β β βββ gettext
β βββ libtasn1
β βββ libunistring
β βββ nettle
β β βββ gmp
β βββ p11-kit
β β βββ ca-certificates
β β βββ libtasn1
β βββ unbound
β βββ libevent
β β βββ openssl@1.1
β β βββ ca-certificates
β βββ libnghttp2
β βββ openssl@1.1
β βββ ca-certificates
βββ jansson
exa
βββ libgit2
βββ libssh2
βββ openssl@1.1
βββ ca-certificates
fd
fnm
fontconfig
βββ freetype
βββ libpng
freetype
βββ libpng
fribidi
gd
βββ fontconfig
β βββ freetype
β βββ libpng
βββ freetype
β βββ libpng
βββ jpeg-turbo
βββ libavif
β βββ aom
β β βββ jpeg-xl
β β β βββ brotli
β β β βββ giflib
β β β βββ highway
β β β βββ imath
β β β βββ jpeg-turbo
β β β βββ libpng
β β β βββ little-cms2
β β β β βββ jpeg-turbo
β β β β βββ libtiff
β β β β βββ jpeg-turbo
β β β β βββ zstd
β β β β βββ lz4
β β β β βββ xz
β β β βββ openexr
β β β β βββ imath
β β β βββ webp
β β β βββ giflib
β β β βββ jpeg-turbo
β β β βββ libpng
β β β βββ libtiff
β β β βββ jpeg-turbo
β β β βββ zstd
β β β βββ lz4
β β β βββ xz
β β βββ libvmaf
β βββ jpeg-turbo
β βββ libpng
βββ libpng
βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ webp
βββ giflib
βββ jpeg-turbo
βββ libpng
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
gdbm
gdk-pixbuf
βββ glib
β βββ pcre2
β βββ gettext
βββ jpeg-turbo
βββ libpng
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
gettext
gh
ghostscript
βββ fontconfig
β βββ freetype
β βββ libpng
βββ freetype
β βββ libpng
βββ jbig2dec
βββ jpeg-turbo
βββ libidn
βββ libpng
βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ little-cms2
β βββ jpeg-turbo
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ openjpeg
βββ libpng
βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ little-cms2
βββ jpeg-turbo
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
giflib
git
βββ gettext
βββ pcre2
git-delta
glib
βββ pcre2
βββ gettext
gmp
gnutls
βββ ca-certificates
βββ gmp
βββ libidn2
β βββ libunistring
β βββ gettext
βββ libtasn1
βββ libunistring
βββ nettle
β βββ gmp
βββ p11-kit
β βββ ca-certificates
β βββ libtasn1
βββ unbound
βββ libevent
β βββ openssl@1.1
β βββ ca-certificates
βββ libnghttp2
βββ openssl@1.1
βββ ca-certificates
graphite2
graphviz
βββ gd
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ jpeg-turbo
β βββ libavif
β β βββ aom
β β β βββ jpeg-xl
β β β β βββ brotli
β β β β βββ giflib
β β β β βββ highway
β β β β βββ imath
β β β β βββ jpeg-turbo
β β β β βββ libpng
β β β β βββ little-cms2
β β β β β βββ jpeg-turbo
β β β β β βββ libtiff
β β β β β βββ jpeg-turbo
β β β β β βββ zstd
β β β β β βββ lz4
β β β β β βββ xz
β β β β βββ openexr
β β β β β βββ imath
β β β β βββ webp
β β β β βββ giflib
β β β β βββ jpeg-turbo
β β β β βββ libpng
β β β β βββ libtiff
β β β β βββ jpeg-turbo
β β β β βββ zstd
β β β β βββ lz4
β β β β βββ xz
β β β βββ libvmaf
β β βββ jpeg-turbo
β β βββ libpng
β βββ libpng
β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ webp
β βββ giflib
β βββ jpeg-turbo
β βββ libpng
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ gts
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ netpbm
β β βββ jasper
β β β βββ jpeg-turbo
β β βββ jpeg-turbo
β β βββ libpng
β β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ gettext
βββ libpng
βββ librsvg
β βββ cairo
β β βββ fontconfig
β β β βββ freetype
β β β βββ libpng
β β βββ freetype
β β β βββ libpng
β β βββ glib
β β β βββ pcre2
β β β βββ gettext
β β βββ libpng
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ libxext
β β β βββ libx11
β β β β βββ libxcb
β β β β β βββ libxau
β β β β β β βββ xorgproto
β β β β β βββ libxdmcp
β β β β β βββ xorgproto
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ libxrender
β β β βββ libx11
β β β β βββ libxcb
β β β β β βββ libxau
β β β β β β βββ xorgproto
β β β β β βββ libxdmcp
β β β β β βββ xorgproto
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ lzo
β β βββ pixman
β βββ gdk-pixbuf
β β βββ glib
β β β βββ pcre2
β β β βββ gettext
β β βββ jpeg-turbo
β β βββ libpng
β β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ pango
β βββ cairo
β β βββ fontconfig
β β β βββ freetype
β β β βββ libpng
β β βββ freetype
β β β βββ libpng
β β βββ glib
β β β βββ pcre2
β β β βββ gettext
β β βββ libpng
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ libxext
β β β βββ libx11
β β β β βββ libxcb
β β β β β βββ libxau
β β β β β β βββ xorgproto
β β β β β βββ libxdmcp
β β β β β βββ xorgproto
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ libxrender
β β β βββ libx11
β β β β βββ libxcb
β β β β β βββ libxau
β β β β β β βββ xorgproto
β β β β β βββ libxdmcp
β β β β β βββ xorgproto
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ lzo
β β βββ pixman
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ fribidi
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ harfbuzz
β βββ cairo
β β βββ fontconfig
β β β βββ freetype
β β β βββ libpng
β β βββ freetype
β β β βββ libpng
β β βββ glib
β β β βββ pcre2
β β β βββ gettext
β β βββ libpng
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ libxext
β β β βββ libx11
β β β β βββ libxcb
β β β β β βββ libxau
β β β β β β βββ xorgproto
β β β β β βββ libxdmcp
β β β β β βββ xorgproto
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ libxrender
β β β βββ libx11
β β β β βββ libxcb
β β β β β βββ libxau
β β β β β β βββ xorgproto
β β β β β βββ libxdmcp
β β β β β βββ xorgproto
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ lzo
β β βββ pixman
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ graphite2
β βββ icu4c
βββ libtool
β βββ m4
βββ pango
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ fontconfig
β βββ freetype
β βββ libpng
βββ freetype
β βββ libpng
βββ fribidi
βββ glib
β βββ pcre2
β βββ gettext
βββ harfbuzz
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ freetype
β βββ libpng
βββ glib
β βββ pcre2
β βββ gettext
βββ graphite2
βββ icu4c
gts
βββ glib
β βββ pcre2
β βββ gettext
βββ netpbm
β βββ jasper
β β βββ jpeg-turbo
β βββ jpeg-turbo
β βββ libpng
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ gettext
guile
βββ bdw-gc
βββ gmp
βββ libtool
β βββ m4
βββ libunistring
βββ pkg-config
βββ readline
harfbuzz
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ freetype
β βββ libpng
βββ glib
β βββ pcre2
β βββ gettext
βββ graphite2
βββ icu4c
heroku/brew/heroku
βββ heroku/brew/heroku-node
heroku/brew/heroku-node
highway
htop
βββ ncurses
icu4c
imagemagick
βββ freetype
β βββ libpng
βββ ghostscript
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ jbig2dec
β βββ jpeg-turbo
β βββ libidn
β βββ libpng
β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ little-cms2
β β βββ jpeg-turbo
β β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ openjpeg
β βββ libpng
β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ little-cms2
β βββ jpeg-turbo
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ jpeg-turbo
βββ libheif
β βββ aom
β β βββ jpeg-xl
β β β βββ brotli
β β β βββ giflib
β β β βββ highway
β β β βββ imath
β β β βββ jpeg-turbo
β β β βββ libpng
β β β βββ little-cms2
β β β β βββ jpeg-turbo
β β β β βββ libtiff
β β β β βββ jpeg-turbo
β β β β βββ zstd
β β β β βββ lz4
β β β β βββ xz
β β β βββ openexr
β β β β βββ imath
β β β βββ webp
β β β βββ giflib
β β β βββ jpeg-turbo
β β β βββ libpng
β β β βββ libtiff
β β β βββ jpeg-turbo
β β β βββ zstd
β β β βββ lz4
β β β βββ xz
β β βββ libvmaf
β βββ jpeg-turbo
β βββ libde265
β βββ libpng
β βββ shared-mime-info
β β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ x265
βββ liblqr
β βββ glib
β βββ pcre2
β βββ gettext
βββ libpng
βββ libraw
β βββ jasper
β β βββ jpeg-turbo
β βββ jpeg-turbo
β βββ little-cms2
β β βββ jpeg-turbo
β β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ libomp
βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ libtool
β βββ m4
βββ little-cms2
β βββ jpeg-turbo
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ openexr
β βββ imath
βββ openjpeg
β βββ libpng
β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ little-cms2
β βββ jpeg-turbo
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ webp
β βββ giflib
β βββ jpeg-turbo
β βββ libpng
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ xz
βββ libomp
imath
jansson
jasper
βββ jpeg-turbo
jbig2dec
jpeg-turbo
jpeg-xl
βββ brotli
βββ giflib
βββ highway
βββ imath
βββ jpeg-turbo
βββ libpng
βββ little-cms2
β βββ jpeg-turbo
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ openexr
β βββ imath
βββ webp
βββ giflib
βββ jpeg-turbo
βββ libpng
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
jq
βββ oniguruma
krb5
βββ openssl@1.1
βββ ca-certificates
libavif
βββ aom
β βββ jpeg-xl
β β βββ brotli
β β βββ giflib
β β βββ highway
β β βββ imath
β β βββ jpeg-turbo
β β βββ libpng
β β βββ little-cms2
β β β βββ jpeg-turbo
β β β βββ libtiff
β β β βββ jpeg-turbo
β β β βββ zstd
β β β βββ lz4
β β β βββ xz
β β βββ openexr
β β β βββ imath
β β βββ webp
β β βββ giflib
β β βββ jpeg-turbo
β β βββ libpng
β β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ libvmaf
βββ jpeg-turbo
βββ libpng
libde265
libevent
βββ openssl@1.1
βββ ca-certificates
libheif
βββ aom
β βββ jpeg-xl
β β βββ brotli
β β βββ giflib
β β βββ highway
β β βββ imath
β β βββ jpeg-turbo
β β βββ libpng
β β βββ little-cms2
β β β βββ jpeg-turbo
β β β βββ libtiff
β β β βββ jpeg-turbo
β β β βββ zstd
β β β βββ lz4
β β β βββ xz
β β βββ openexr
β β β βββ imath
β β βββ webp
β β βββ giflib
β β βββ jpeg-turbo
β β βββ libpng
β β βββ libtiff
β β βββ jpeg-turbo
β β βββ zstd
β β βββ lz4
β β βββ xz
β βββ libvmaf
βββ jpeg-turbo
βββ libde265
βββ libpng
βββ shared-mime-info
β βββ glib
β βββ pcre2
β βββ gettext
βββ x265
libidn
libidn2
βββ libunistring
βββ gettext
liblqr
βββ glib
βββ pcre2
βββ gettext
libnghttp2
libomp
libpng
libraw
βββ jasper
β βββ jpeg-turbo
βββ jpeg-turbo
βββ little-cms2
β βββ jpeg-turbo
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ libomp
librsvg
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ gdk-pixbuf
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ jpeg-turbo
β βββ libpng
β βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ glib
β βββ pcre2
β βββ gettext
βββ pango
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ fontconfig
β βββ freetype
β βββ libpng
βββ freetype
β βββ libpng
βββ fribidi
βββ glib
β βββ pcre2
β βββ gettext
βββ harfbuzz
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ freetype
β βββ libpng
βββ glib
β βββ pcre2
β βββ gettext
βββ graphite2
βββ icu4c
libtasn1
libtermkey
βββ unibilium
libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
libtool
βββ m4
libunistring
libuv
libvmaf
libvterm
libx11
βββ libxcb
β βββ libxau
β β βββ xorgproto
β βββ libxdmcp
β βββ xorgproto
βββ xorgproto
libxau
βββ xorgproto
libxcb
βββ libxau
β βββ xorgproto
βββ libxdmcp
βββ xorgproto
libxdmcp
βββ xorgproto
libxext
βββ libx11
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ xorgproto
βββ xorgproto
libxrender
βββ libx11
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ xorgproto
βββ xorgproto
libyaml
little-cms2
βββ jpeg-turbo
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
lua
luajit
luv
βββ libuv
lz4
lzo
m4
mpdecimal
msgpack
ncdu
βββ ncurses
ncurses
neovim
βββ gettext
βββ libtermkey
β βββ unibilium
βββ libuv
βββ libvterm
βββ luajit
βββ luv
β βββ libuv
βββ msgpack
βββ tree-sitter
βββ unibilium
netpbm
βββ jasper
β βββ jpeg-turbo
βββ jpeg-turbo
βββ libpng
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
nettle
βββ gmp
oniguruma
openexr
βββ imath
openjpeg
βββ libpng
βββ libtiff
β βββ jpeg-turbo
β βββ zstd
β βββ lz4
β βββ xz
βββ little-cms2
βββ jpeg-turbo
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
openssl@1.1
βββ ca-certificates
openssl@3
βββ ca-certificates
p11-kit
βββ ca-certificates
βββ libtasn1
pango
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ fontconfig
β βββ freetype
β βββ libpng
βββ freetype
β βββ libpng
βββ fribidi
βββ glib
β βββ pcre2
β βββ gettext
βββ harfbuzz
βββ cairo
β βββ fontconfig
β β βββ freetype
β β βββ libpng
β βββ freetype
β β βββ libpng
β βββ glib
β β βββ pcre2
β β βββ gettext
β βββ libpng
β βββ libx11
β β βββ libxcb
β β β βββ libxau
β β β β βββ xorgproto
β β β βββ libxdmcp
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxcb
β β βββ libxau
β β β βββ xorgproto
β β βββ libxdmcp
β β βββ xorgproto
β βββ libxext
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ libxrender
β β βββ libx11
β β β βββ libxcb
β β β β βββ libxau
β β β β β βββ xorgproto
β β β β βββ libxdmcp
β β β β βββ xorgproto
β β β βββ xorgproto
β β βββ xorgproto
β βββ lzo
β βββ pixman
βββ freetype
β βββ libpng
βββ glib
β βββ pcre2
β βββ gettext
βββ graphite2
βββ icu4c
pcre
pcre2
perl
βββ berkeley-db
β βββ openssl@1.1
β βββ ca-certificates
βββ gdbm
pixman
pkg-config
postgresql@14
βββ icu4c
βββ krb5
β βββ openssl@1.1
β βββ ca-certificates
βββ lz4
βββ openssl@1.1
β βββ ca-certificates
βββ readline
pure
βββ zsh-async
python@3.11
βββ mpdecimal
βββ openssl@1.1
β βββ ca-certificates
βββ sqlite
β βββ readline
βββ xz
rbenv
βββ ruby-build
βββ autoconf
β βββ m4
βββ pkg-config
βββ readline
rcm
readline
redis
βββ openssl@1.1
βββ ca-certificates
ripgrep
βββ pcre2
ruby
βββ libyaml
βββ openssl@1.1
β βββ ca-certificates
βββ readline
ruby-build
βββ autoconf
β βββ m4
βββ pkg-config
βββ readline
rust
βββ openssl@1.1
β βββ ca-certificates
βββ pkg-config
shared-mime-info
βββ glib
βββ pcre2
βββ gettext
sl
sqlite
βββ readline
terminal-notifier
tig
βββ ncurses
βββ pcre2
βββ readline
tmux
βββ libevent
β βββ openssl@1.1
β βββ ca-certificates
βββ ncurses
βββ utf8proc
tree
tree-sitter
unbound
βββ libevent
β βββ openssl@1.1
β βββ ca-certificates
βββ libnghttp2
βββ openssl@1.1
βββ ca-certificates
unibilium
utf8proc
vim
βββ gettext
βββ lua
βββ ncurses
βββ perl
β βββ berkeley-db
β β βββ openssl@1.1
β β βββ ca-certificates
β βββ gdbm
βββ python@3.11
β βββ mpdecimal
β βββ openssl@1.1
β β βββ ca-certificates
β βββ sqlite
β β βββ readline
β βββ xz
βββ ruby
βββ libyaml
βββ openssl@1.1
β βββ ca-certificates
βββ readline
watch
βββ ncurses
webp
βββ giflib
βββ jpeg-turbo
βββ libpng
βββ libtiff
βββ jpeg-turbo
βββ zstd
βββ lz4
βββ xz
wget
βββ libidn2
β βββ libunistring
β βββ gettext
βββ openssl@3
βββ ca-certificates
x265
xorgproto
xz
yarn
youtube-dl
βββ python@3.11
βββ mpdecimal
βββ openssl@1.1
β βββ ca-certificates
βββ sqlite
β βββ readline
βββ xz
zsh
βββ ncurses
βββ pcre
zsh-async
zsh-syntax-highlighting
zstd
βββ lz4
βββ xz
As we can see⦠tons of things depend on xz.
This output is slightly overwhelming, but if you want to be even more overwhelmed, you can run brew deps --full-name --installed --graph
to produce a visual graph representation, which Iβll present to you here:
You can click on it to see it in more detail.
Maybe Iβm not much of a visual learner, but Iβll take the plain text representation any day.
How do I know if I even need this package any longer?
One easy way to figure out if you need a package any longer is to just try uninstalling it and seeing what happens:
$ brew uninstall xz
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################## 100.0%
Error: Refusing to uninstall /opt/homebrew/Cellar/xz/5.4.1
because it is required by aom, gd, gdk-pixbuf, ghostscript, graphviz, gts, imagemagick, jpeg-xl, libavif, libheif, libraw, librsvg, libtiff, little-cms2, netpbm, openjpeg, python@3.11, vim, webp, youtube-dl and zstd, which are currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies xz
As you can see, homebrew refuses to uninstall it because itβs a dependency of a bunch of stuff. So, I guess, I do need this one.
It would be tedious to do this one-by-one, going through all ~100 or so of the packages I have installed that I donβt recognize the name of, just to free up some space on my hard drive.
Thankfully, it turns out that homebrew has another command, brew leaves
, which will solve this problem.
If I run brew list
, homebrew prints out 138 packages, many with names I donβt recognize.
If I run brew leaves
instead, it prints out 38 packages, most of which I recall asking homebrew to install.
Letβs learn more about this subcommand:
$ brew leaves --help
Usage: brew leaves [--installed-on-request] [--installed-as-dependency]
List installed formulae that are not dependencies of another installed formula.
-r, --installed-on-request Only list leaves that were manually
installed.
-p, --installed-as-dependency Only list leaves that were installed as
dependencies.
-d, --debug Display any debugging information.
-q, --quiet Make some output more quiet.
-v, --verbose Make some output more verbose.
-h, --help Show this message.
In other words, running brew leaves
will print out all of the things that can be uninstalled, because nothing depends on them.
In my case, that includes vim, but not xz.
So, if thereβs anything in the brew leaves
output that you donβt think you need, you can probably safely uninstall it.
There are two flags there that are particularly handy: --installed-on-request
and --installed-as-dependency
, which filter the output based on why exactly that package is installed on your system.
If you run brew leaves --installed-as-dependency
, it will print out all of the things that:
- were installed as a dependency of something else
- but are no longer a dependency of anything
That sounds eminently uninstallable if anything does.
Note that when you uninstall a package, homebrew does not uninstall that packageβs dependencies. That means that many of that packageβs dependencies, which were previously not uninstallable become uninstallable. In other words, they become leaves.
So, for example, if I run brew uninstall imagemagick
and then check on my leaves, hereβs what I see:
$ brew leaves --installed-as-dependency
ghostscript
libheif
liblqr
libraw
I still have ghostscript, libheif, liblqr, and libraw hanging around, and I can use this command to identify that they are not actually needed anymore and continue trimming my hedge.
-
If homebrew wants to upgrade vim, Iβll usually quit any running vim processes, because it sometimes gets wonky when you upgrade it while itβs already running.Β ↩
-
Which I can see spelled out in my BrewfileΒ ↩