How to cleanly remove Homebrew

Solution 1:

This rm -rf will not ask if you are sure when you delete, so be sure the cd command works to get you out of /tmp (the cd /tmp gets you to a safe place in case you copy/paste everything in one go so you don't delete files from your current directory)

Try this in your Terminal:

cd /tmp
cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew

More info about this topic can be found in the Homebrew FAQ.

Solution 2:

While HomeBrew's install is prominently located on its front page, details are not. https://brew.sh/ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" For a long time it was very difficult to find a reliable uninstall. Now, several clicks away in the docs, there is now an official method: https://docs.brew.sh/FAQ To uninstall Homebrew, paste the command below in a terminal prompt. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"