当我运行此命令时:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
我收到以下错误:
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The current contents of /usr/local are bin CODEOFCONDUCT.md git include lib libexec Library LICENSE.txt n share var .git .github .gitignore
但是,当我运行brew doctor
时,会抛出此错误:
bash: brew: command not found
当我尝试使用此脚本卸载Homebrew时:
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
我的命令提示符响应:
Failed to locate Homebrew!
请帮忙。
答案 0 :(得分:2)
首先手动删除所有自制文件。然后从头开始重新安装Homebrew。前缀sudo
由您自行决定:
# packages
rm -rf /usr/local/Cellar
# executable
rm /usr/local/bin/brew
# meta
rm -rf /usr/local/.git
rm /usr/local/.github
rm /usr/local/.gitignore
rm /usr/local/.travis.yml
rm /usr/local/.yardopts
rm /usr/local/CODEOFCONDUCT.md
rm /usr/local/LICENSE.txt
rm /usr/local/README.md
# home
rm ~/.rvm/bin/brew
rm ~/.homebrew
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew
# other
rm -rf /Library/Caches/Homebrew
# find more files to delete; delete Homebrew files only!
find / -name "*brew*"
重要说明:由于重新安装时出现权限错误,您可能需要在重新安装之前执行以下步骤之一;见:https://github.com/Homebrew/legacy-homebrew/issues/15138
# via: https://github.com/Homebrew/legacy-homebrew/issues/15138#issuecomment-19258042
cd /usr/local
sudo mv -v Library Library.old
# --OR--
# via: https://github.com/Homebrew/legacy-homebrew/issues/15138#issuecomment-33338868
# see: http://linuxcommand.org/man_pages/chmod1.html
cd /usr/local
chmod -R 775 Library
重新安装Homebrew;见:http://brew.sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
答案 1 :(得分:1)
最新版本的XCode和Homebrew存在问题。打开终端并运行:
rm -rf /usr/local/Cellar /usr/local/.git
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果您获得权限被拒,请使用sudo
。卸载Homebrew时,目录/usr/local/Cellar/
被完全删除,因此可以安全删除它。