How to uninstall Homebrew on Mac

To uninstall Homebrew on a Mac, run the uninstall script from Homebrew’s own GitHub repository: it removes the brew command and everything installed with it. Before that, save the list of your packages and stop their services. Apps installed as casks are a separate case.

Before you uninstall Homebrew

The script deletes every formula Homebrew installed, together with its data in Homebrew’s folders: a database from the postgresql@17 or mysql formula keeps its files under /opt/homebrew/var (/usr/local/var on Intel), and they go too. Save what you need first.

brew list brew services list brew bundle dump --file ~/Brewfile

The first command shows what is installed, the second the running services, the third saves all packages to a Brewfile in your home folder, from which Homebrew can put them back later. Back up databases with their own tools, and stop each service, with its name in place of <name>:

brew services stop <name>

How to uninstall Homebrew with the official script

Open Terminal and run the command from the Homebrew/install repository. It asks for confirmation and for your Mac password.

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

For Homebrew in a non-standard place (on an Apple silicon Mac it may also sit in /usr/local from an Intel past), download the script and give it the path:

curl -fsSLO https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh /bin/bash uninstall.sh --path /usr/local

The script lists its other options itself:

/bin/bash uninstall.sh --help

What happens to apps installed with brew install --cask

Apps from casks (Chrome, VS Code, Docker Desktop…) live in Applications like any other app. If you want them gone too, remove them one by one while Homebrew is still there, with the cask’s name in place of <name>:

brew uninstall --cask <name>

Add --zap to also delete the files the cask knows about. Apps you keep go on working without Homebrew, they just stop updating through it.

Remove what the script leaves behind

At the end the script prints The following possible Homebrew files were not deleted: and a list: folders inside /opt/homebrew (bin, etc, lib) on Apple silicon, or in /usr/local on Intel. Look at them before you delete anything: there may be tools you installed globally with npm (such as pnpm or yarn in /opt/homebrew/bin) and settings in etc. When you no longer need any of it, remove the whole folder:

sudo rm -rf /opt/homebrew

Homebrew added a line to ~/.zprofile during install: eval "$(/opt/homebrew/bin/brew shellenv)". Without Homebrew it makes each new Terminal window complain no such file or directory: /opt/homebrew/bin/brew. Open the file in TextEdit, delete that line and save:

open -e ~/.zprofile

The download cache stays in ~/Library/Caches/Homebrew. It holds only downloaded installers, delete it:

rm -rf ~/Library/Caches/Homebrew

Open a new Terminal window. This command should print nothing there:

which brew

Keep your Mac tidy

Uninstaller: a list of apps sorted by size with when each was last opened, Google Chrome selected with its app and cache sizes

MacWashing doesn’t remove Homebrew itself: use the script above. If you only want to get rid of some tools, its Uninstaller lists the formulae you installed, for example node or postgresql@17 marked Homebrew, and removes them with brew. Their data folders show as Possible and stay unchecked.

Free trial · macOS 14 or later

Questions and answers

How do I uninstall Homebrew on Mac?

Run the official script in Terminal: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" Then delete the leftover /opt/homebrew folder and the shellenv line in ~/.zprofile.

Does uninstalling Homebrew delete the apps I installed with it?

Formulae (command-line tools) go with Homebrew. Apps from casks stay in Applications unless you remove them first with: brew uninstall --cask <name>

Can I reinstall Homebrew later?

Yes. Install it again with the command from brew.sh, see how to install Homebrew on Mac, and restore your packages with: brew bundle --file ~/Brewfile