Skip to content

Instantly share code, notes, and snippets.

@Sitin
Forked from mxcl/uninstall_homebrew.sh
Last active December 26, 2015 02:48
Show Gist options
  • Save Sitin/7080853 to your computer and use it in GitHub Desktop.
Save Sitin/7080853 to your computer and use it in GitHub Desktop.
#!/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 /usr/local/.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
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
# Change rights and ownership
directories=( /usr/local /usr/local/bin /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share )
for directory in "${directories[@]}"; do
sudo chown root:wheel $directory ; sudo chmod 755 $directory
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment