处理 Homebrew 问题

执行如下命令:

cd `brew –prefix`

mv Cellar /tmp

brew prune

rm -r `git ls-files`

rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions

rm -rf .git

rm -rf ~/Library/Caches/Homebrew

然后重新安装 Homebrew:

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

brew update

把备份的程序复制回来,更新所有程序:

mv /tmp/Cellar .

brew update

brew upgrade

执行完,你之前安装的大部分程序和库就可以正常使用。

如果遇到

-bash: brew: command not found

需要在 .bashrc file中添加一行
export PATH=/usr/local/bin:$PATH