How to uninstall homebrew?

和自甴很熟 提交于 2019-12-12 10:08:30

问题


I installed homebrew today without really knowing what I was doing, and now my scikit-learn package is broken. I want to undo everything that I did by uninstalling homebrew, and tried following the tips here: https://github.com/Homebrew/homebrew/wiki/FAQ

However, I think homebrew installed into /usr/bin/local, and not /usr/bin/, so I'm not sure I can use the instructions in the link.

When I initially installed homebrew (ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"), I got the following messages:

==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/lib/pkgconfig
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7

Can I just delete the files in

/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

I'm terrified of screwing something up in the uninstallation process. Incidentally, would uninstalling homebrew even restore my system to what it was before? How would I go about doing that?


回答1:


This is covered in the homebrew FAQ:

https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#how-do-i-uninstall-homebrew

It specifies a script you can run to do it. You should run that script. As of right now, the script says something like:

#!/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



回答2:


I've written a script specifically for un-installing Homebrew, and in my opinion it is currently the best tool for the job. You can find it here:

https://gist.github.com/SteveBenner/11254428




回答3:


This worked for me

Official brew uninstalling steps:

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

But /usr/bin/ruby is just symlink in order to find your ruby you need to type

which ruby

Which will give you /snap/bin/ruby

So then just use this :

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


来源:https://stackoverflow.com/questions/23251665/how-to-uninstall-homebrew

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!