How to Completely Reset Homebrew

How to Completely Reset Homebrew (Formulae, Casks, and All the Junk)

Published:  3 min read
homebrewmacOScleanupuninstall

Homebrew is great… until it isn’t.

After enough projects, experiments, and “I’ll uninstall it later” moments, your system ends up with:

  • old formulae you forgot about
  • random GUI apps installed via casks
  • cached junk taking up disk space
  • dependency conflicts that make zero sense

If you’re at the point where you just want to start fresh, this guide walks you from light cleanup to full nuclear option.

I’ve collated all the commands here and broken it down into clear steps so you can choose how deep you want to go.


Step 0: See What You’re About to Destroy (Optional but Sensible)

Before you pull the pin, it’s worth seeing what’s currently installed.

List installed formulae

brew list --formula

List installed casks (GUI apps)

brew list --cask

If you want a “just in case” backup:

brew list --formula > brew-formulae.txt
brew list --cask > brew-casks.txt

Future-you may thank past-you.


Step 1: Remove All Installed Formulae

This is the core trick.

brew remove --force $(brew list --formula) --ignore-dependencies

What’s happening here

  • brew list --formula → grabs every installed CLI package
  • brew remove --force → no questions asked
  • --ignore-dependencies → don’t try to be clever, just delete

Result: all formulae gone.


Step 2: Remove All Installed Casks (GUI Apps)

Formulae are only half the story. Casks install things like:

  • browsers
  • IDEs
  • Docker Desktop
  • random tools you tried once at 2am

To remove all casks:

brew remove --cask --force $(brew list --cask)

⚠️ This will uninstall GUI apps managed by Homebrew. If you installed something manually (drag-and-drop), it won’t touch those.


Step 3: Clean Up Leftover Junk

Even after uninstalling everything, Homebrew leaves behind:

  • cached downloads
  • old build artifacts
  • orphaned symlinks

Clean it up:

brew cleanup --prune=all

To see what Homebrew thinks is wrong:

brew doctor

Step 4: Optional - Remove Homebrew Completely (Scorched Earth)

If you want a true clean slate, including Homebrew itself:

Uninstall Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

Manually remove leftovers (Intel Macs)

sudo rm -rf /usr/local/Homebrew
sudo rm -rf /usr/local/Caskroom
sudo rm -rf /usr/local/Cellar

Apple Silicon Macs (M1/M2/M3)

sudo rm -rf /opt/homebrew

Remove shell config leftovers

Check and clean these files:

  • ~/.zshrc
  • ~/.bashrc
  • ~/.bash_profile

Look for lines like:

eval "$(/opt/homebrew/bin/brew shellenv)"

…and remove them.


Step 5: Reinstall Only What You Actually Need

Now reinstall Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then reinstall selectively:

brew install git terraform ansible
brew install --cask iterm2 visual-studio-code

This is the moment where your system goes from junk drawer to well-organized toolbox.


Pros & Cons of the Nuclear Approach

✅ Pros

  • Fixes weird dependency issues instantly
  • Forces you to be intentional about tooling
  • Faster than debugging Homebrew conflicts

❌ Cons

  • You will forget one tool you “totally needed”
  • Reinstalling takes time
  • Some GUI apps may lose settings

Key Takeaways

  • Homebrew doesn’t offer a “reset” button; but shell one-liners do
  • Formulae and casks must be removed separately
  • brew cleanup is not optional if you want disk space back
  • A full uninstall is sometimes the fastest way forward

Use responsibly. Or irresponsibly. Both work.