How to uninstall Homebrew?

I’ve got some problems with the package manager, Homebrew. I can’t find how to remove it!

Is it safe to remove whole /usr/local? Homebrew was installed somewhere in that directory.


Solution 1:

They provide an official uninstall script you can download and run:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Homebrew once recommended an older script, also linked in their FAQ.

Here is a copy of the old script, for historical purposes:

cd `brew --prefix`
git checkout master
git ls-files -z | pbcopy
rm -rf Cellar
bin/brew prune
pbpaste | xargs -0 rm
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions 
test -d Library/LinkedKegs && rm -r Library/LinkedKegs
rmdir -p bin Library share/man/man1 2> /dev/null
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew
rm -rf /Library/Caches/Homebrew

This should also revert your /usr/local folder to its pre-Homebrew days. See the Homebrew installation wiki for more information.

Note: You may also need to remove ~/.homebrew as well. If you happen to have ~/.rvm, then you should delete ~/.rvm/bin/brew. If any of your brew package had brew services that are running, you should turn them off. If any packages installed their own libraries (like Python's pip) you'll have to uninstall those manually.

Solution 2:

Homebrew provides an uninstall script located here.

Just run the following in the OSX terminal:

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