Member-only story

A Guide to brew cleanup --prune=all: Keeping Your Homebrew Setup Lean and Clean

Luca Berton
5 min readDec 19, 2024

Homebrew, the popular package manager for macOS and Linux, is a powerful tool for managing software installations and dependencies. Over time, however, it’s easy for your Homebrew environment to accumulate unused files, outdated packages, and unnecessary cached data. This is where brew cleanup --prune=all comes into play—a command that helps you declutter your system and reclaim precious disk space. Let’s dive into what this command does, how it works, and when to use it.

What Does brew cleanup Do?

The brew cleanup command removes old versions of installed formulae and casks that are no longer needed. It also deletes cached downloads and other obsolete data associated with Homebrew packages.

By default, Homebrew keeps the most recent versions of your installed formulae and casks. However, as you upgrade software over time, the older versions remain stored on your system. While this backup mechanism can be useful, it often leads to unnecessary clutter.

Understanding the --prune=all Option

The --prune=all flag takes the cleanup process one step further by targeting all outdated and orphaned files. Here’s a breakdown of its effects:

  1. Complete Removal of Old Versions: It ensures that any old versions of formulae or casks, regardless of how many updates have occurred, are removed.

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet