Skip to content

Instantly share code, notes, and snippets.

@hfm
Forked from mxcl/uninstall_homebrew.sh
Created July 14, 2012 12:22
Show Gist options
  • Save hfm/3110944 to your computer and use it in GitHub Desktop.
Save hfm/3110944 to your computer and use it in GitHub Desktop.
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
/usr/bin/which -s git || abort "brew install git first!"
test -d `brew --prefix`/.git || abort "brew update first!"
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
test -d Library/Taps && rm -r Library/Taps
test -d Library/ENV && rm -r Library/ENV
rmdir -p bin Library share/man/man1 2>/dev/null
rm -rf .git
rm -f .gitignore
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew
rm -rf /Library/Caches/Homebrew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment