Skip to content
Theme:

Remove unused brew dependencies and delete outdated downloads

You’re reading it, so I assume you know what the brew is and most likely, you use it. If you don’t, check out my “Homebrew — the best friend of the macOS user” that I published a few years ago.

Have you ever been wondering why brew list comes back with a gazillion packages even though you installed only a handful of them? These are your packages and all their dependencies. Compare it with the output of brew leaves that shows only top-level packages (most likely the ones you explicitly installed).

For instance, when you do brew install git, you add git executable and gettext and pcre2 as dependencies. Unfortunately, when you reverse this process with brew uninstall git, the main formula disappears, but you end up with two no longer needed dependencies. After a while, it is easy to end up with hundreds of programs that clutter your hard drive. Luckily, there’s a simple solution to solve this problem.

brew uninstall git
brew autoremove

The autoremove command removes all the hanging, no longer needed packages from your computer. So say goodbye to unneeded dependencies and messy brew list output.

~ brew help autoremove 

Uninstall formulae that were only installed as a dependency of another formula
and are now no longer needed.

If you want to take your tidy-up routine to the next level, you can also run brew cleanup. This command removes downloads for outdated formulas and casks.

~ brew help cleanup

Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks. Removes all downloads more than 120 days
old. This can be adjusted with HOMEBREW_CLEANUP_MAX_AGE_DAYS.

OK. Enough procrastination, pretending that you are doing productive work by shaving off a few MBs of your hard drive. Get back to work!

Comments

  • M
    Maz

    Thank you!

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      My pleasure 😄

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • j
    jackrubin

    aha!

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • 1
      16by9

      This clean slick ass website made me comment ser.

      Thank you now have only 3 packages installed.

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • S
    Serotonin

    Just wanted to let you know that you helped me out today, thanks a lot.

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      Thanks a lot! You just made my day and because of people like you I write this blog.

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • T
    Tom

    Awesome! Was driving me crazy...

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      No worries. I am glad it helped you out.

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • J
    Jim Worrall

    Good information (especially autoremove), and I like your style!

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      Thanks a lot! More is coming for sure!

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • d
    darvindale

    pretty cool

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • P
      Paweł Grzybek

      I glad it helped you out.

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • b
    bajas

    Perfect! Clean and simple - just what I needed.

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • P
      Paweł Grzybek

      Nice. Thanks for visiting!

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • n
    nic

    Big thanks for this one, learned something new today

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      Thats what makes me happy! Enjoy :)

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • K
    Khurshidbek Sobirov

    Thank you mate! 👍

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Paweł Grzybek
      Paweł Grzybek

      Pleasure it helped you out 🤗

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • T
    Tech Priest

    Helped a ton, thanks

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!

Leave a comment

👆 you can use Markdown here

Your comment is awaiting moderation. Thanks!