Apps & uninstalling
How to Properly Uninstall Homebrew From Your Mac
Remove Homebrew from your Mac including all installed packages, the Homebrew prefix, casks, and the leftover paths in your shell profile.
Homebrew isn’t an app — it’s a package manager that lives in /opt/homebrew/ (Apple Silicon) or /usr/local/ (Intel) and manages hundreds of CLI tools and apps. Uninstalling it isn’t just removing a folder; it’s removing the entire Homebrew prefix plus everything you’ve ever brew install-ed.
If you’re switching to MacPorts, Nix, or just done with managing CLI tools this way, Homebrew has an official uninstall script that handles most of the work. There are still a few cleanup steps it doesn’t do. Here’s the full removal on macOS Sonoma 14 and Sequoia 15.
What does Homebrew leave on your Mac?
Before uninstalling, it’s worth understanding what’s actually there:
- The Homebrew prefix:
/opt/homebrew/on Apple Silicon,/usr/local/Homebrew/plus/usr/local/Cellar/on Intel - Every formula (CLI tool) you’ve installed
- Every cask (GUI app) you’ve installed via
brew install --cask - Cached downloads in
~/Library/Caches/Homebrew/ - Logs in
~/Library/Logs/Homebrew/ - Shell PATH additions in your
.zshrcor.bash_profile
A typical dev machine has 50–200 formulae and 20–40 casks installed via Homebrew. The total disk footprint can run anywhere from 2 GB to 20+ GB.
List everything you have installed first
Before nuking, dump your installed packages so you can decide what to keep or restore later:
brew list --formula > ~/Desktop/brew-formulae.txt
brew list --cask > ~/Desktop/brew-casks.txt
brew tap > ~/Desktop/brew-taps.txt
Three files on your Desktop with everything Homebrew has installed. Useful even if you’re nuking — you might realize there are tools you actually want to reinstall via a different package manager (or directly).
If you’re using Homebrew Bundle, you can also generate a Brewfile:
brew bundle dump --file=~/Desktop/Brewfile
This creates a portable manifest you can use to restore everything on a fresh install.
brew leaves to see only the top-level packages you explicitly installed (not their dependencies). Often the list is much shorter than brew list — typically 30 packages instead of 200. This is what's actually worth tracking.Use the official uninstall script
Homebrew provides a one-line uninstall script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Confirm at the prompt. The script:
- Lists every file it’s about to remove
- Asks for confirmation
- Removes the Homebrew prefix
- Removes all installed formulae
- Removes shell completions in standard locations
- Cleans up
/etc/paths.d/if Homebrew added entries there
It does NOT:
- Remove cached downloads in
~/Library/Caches/Homebrew/ - Remove logs in
~/Library/Logs/Homebrew/ - Remove your Brewfile
- Remove casks (the GUI apps Homebrew installed) — those stay in
/Applications/after the script runs - Edit your shell profile to remove
eval "$(brew shellenv)"lines
So we have manual cleanup ahead.
Manually remove Homebrew casks
Casks are GUI apps installed via brew install --cask <name>. They live in /Applications/ after install. The Homebrew uninstall script leaves them there.
You have two options:
Option A: uninstall casks via Homebrew before nuking the prefix:
brew list --cask | xargs -n1 brew uninstall --cask
This properly uninstalls each cask, which means Homebrew also removes their support files. Run this BEFORE the main uninstall script.
Option B: leave casks in /Applications and remove them later as regular Mac apps. Fine if you want to keep some of them.
Option A is cleaner if you’re truly nuking everything.
Clean up shell profile
The Homebrew installer adds a line to your shell profile:
eval "$(/opt/homebrew/bin/brew shellenv)"
(or /usr/local/bin/brew on Intel). After uninstall, this line throws a “command not found” error every time you open a terminal.
Find and remove it:
grep -n "brew" ~/.zshrc ~/.bash_profile ~/.bashrc 2>/dev/null
Open the file in your editor and delete the brew-related lines. Common patterns:
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/usr/local/sbin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
Save and start a new terminal session.
Clean up cached downloads and logs
The official script doesn’t touch these:
rm -rf ~/Library/Caches/Homebrew/
rm -rf ~/Library/Logs/Homebrew/
The Caches folder is typically 500 MB to 5 GB — Homebrew caches the source tarballs and binaries it downloads. Worth deleting.
Clean up leftovers from formulae
Some formulae install files outside the Homebrew prefix:
- Launch agents:
~/Library/LaunchAgents/homebrew.mxcl.<name>.plist - Launch daemons:
/Library/LaunchDaemons/homebrew.mxcl.<name>.plist - App Support: scattered across
~/Library/Application Support/per app
For services started with brew services start <name>, check:
ls ~/Library/LaunchAgents/ | grep homebrew
ls /Library/LaunchDaemons/ | grep homebrew
If anything matches, unload and remove:
# For user-level launch agents:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.<name>.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.<name>.plist
# For system-level (admin required):
sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.<name>.plist
sudo rm /Library/LaunchDaemons/homebrew.mxcl.<name>.plist
Common services that leave these: postgresql@<version>, mysql, redis, mongodb-community, nginx.
Verify removal
After all the above:
which brew
ls /opt/homebrew 2>/dev/null
ls /usr/local/Homebrew 2>/dev/null
ls /usr/local/Cellar 2>/dev/null
brew --version
The first should return “brew not found.” The folders should not exist. The brew --version command should fail.
If anything’s still there, you’ve got leftover state. The most common surviving folder is /usr/local/var/ on Intel Macs — Homebrew’s data folder for services like PostgreSQL. Remove with sudo rm -rf /usr/local/var/homebrew if appropriate (be careful — /usr/local/var/ may contain non-Homebrew data on some systems).
Manual vs. Sweep
Homebrew’s case is interesting because the official uninstall script does most of the heavy lifting in /opt/homebrew/ or /usr/local/. Sweep doesn’t replace the uninstall script — it complements it by catching the user-level Caches and Logs folders, and any leftover launch agents from brew services that the script misses.
For a typical Homebrew uninstall:
- Run
brew listandbrew leavesto know what you have - Run the official uninstall script
- Use Sweep (or manually) to clear
~/Library/Caches/Homebrew/,~/Library/Logs/Homebrew/, and any leftover launch agents - Edit your shell profile
That gives you a complete removal in about 10 minutes.
Why people uninstall Homebrew
Worth a quick aside: Homebrew is generally great, but reasons to remove it include:
- Switching to Nix or MacPorts: cleaner sandboxing or different package philosophy
- Apple Silicon migration: if you migrated from Intel and have Rosetta-built Homebrew at
/usr/local/, switching to native Apple Silicon at/opt/homebrew/involves uninstalling and reinstalling - Disk space: a Homebrew prefix that’s accumulated 200 packages over five years can be a real disk hog
- Dependency hell:
brew doctorwarnings stacking up, broken symlinks, half-completed upgrades — sometimes a fresh start is faster than fixing
Reinstalling Homebrew
If you ever come back, the install script is the same one Homebrew has used for years:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then restore your packages from the lists you saved earlier:
xargs brew install < ~/Desktop/brew-formulae.txt
xargs brew install --cask < ~/Desktop/brew-casks.txt
Or from a Brewfile:
brew bundle --file=~/Desktop/Brewfile
Either way, you’re back in business in 20 minutes — probably with a faster, cleaner Homebrew prefix than before.
That’s Homebrew gone. Your /opt/homebrew/ directory is empty (or nonexistent), your shell starts cleanly, and your Caches folder just lost a few gigabytes.