删除 /usr/local/bin 的内容后无法重新安装或卸载 Homebrew
Can't reinstall or uninstall Homebrew after blowing away contents of /usr/local/bin
我删除了 /usr/local/bin 文件夹中的所有内容(包括 'brew')。自制软件不再工作了,我似乎陷入了困境。当我尝试安装时它说:
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)"
当我 运行 给定的卸载命令时,它说:
Failed to locate Homebrew!
背景
当我按照本指南尝试删除 node.js 时出现了问题:
To completely uninstall node + npm is to do the following:
- go to /usr/local/lib and delete any node and node_modules
- go to /usr/local/include and delete any node and node_modules directory
- if you installed with brew install node, then run brew uninstall node in your terminal
- check your Home directory for any local or lib or
include folders, and delete any node or node_modules from there
- go to /usr/local/bin and delete any node executable
尤其是5不好!这就是导致我删除 /usr/local/bin 下的所有内容的原因。所以 brew doctor
将不起作用(不再识别 brew)。 Brew 在此之前运行良好。
我试过的
这也不起作用,因为缺少 brew:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
我尝试了多种脚本,例如:https://apple.stackexchange.com/a/85481. And this: https://gist.github.com/SteveBenner/11254428。 None 它们正在工作(都假设有 brew 命令)...
如何重新安装 Homebrew 才能像以前一样工作?
这应该会恢复正常工作的 brew
命令:
cd /usr/local/Homebrew
git init
git remote add origin https://github.com/Homebrew/homebrew
git pull origin master
接下来我会检查brew doctor
的输出,看看是否有重大问题。如果您想完全卸载,homebrew
的 github
wiki 上有官方卸载指南。
尝试移动或删除 user/local 文件中的 Homebrew 文件,然后尝试使用自制软件主页上的常规 link 安装 brew!
顺便说一句,我没有尝试移动,但我很确定它应该可以。
注意:虽然您可能需要使用 sudo 进行操作
我遇到了同样的问题,下面的 link 真的对我有用
https://github.com/Homebrew/brew/issues/10368
尤其是 MrBenFTW 于 2021 年 2 月发表的评论
我删除了 /usr/local/bin 文件夹中的所有内容(包括 'brew')。自制软件不再工作了,我似乎陷入了困境。当我尝试安装时它说:
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)"
当我 运行 给定的卸载命令时,它说:
Failed to locate Homebrew!
背景
当我按照本指南尝试删除 node.js 时出现了问题:
To completely uninstall node + npm is to do the following:
- go to /usr/local/lib and delete any node and node_modules
- go to /usr/local/include and delete any node and node_modules directory
- if you installed with brew install node, then run brew uninstall node in your terminal
- check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
- go to /usr/local/bin and delete any node executable
尤其是5不好!这就是导致我删除 /usr/local/bin 下的所有内容的原因。所以 brew doctor
将不起作用(不再识别 brew)。 Brew 在此之前运行良好。
我试过的
这也不起作用,因为缺少 brew:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
我尝试了多种脚本,例如:https://apple.stackexchange.com/a/85481. And this: https://gist.github.com/SteveBenner/11254428。 None 它们正在工作(都假设有 brew 命令)...
如何重新安装 Homebrew 才能像以前一样工作?
这应该会恢复正常工作的 brew
命令:
cd /usr/local/Homebrew
git init
git remote add origin https://github.com/Homebrew/homebrew
git pull origin master
接下来我会检查brew doctor
的输出,看看是否有重大问题。如果您想完全卸载,homebrew
的 github
wiki 上有官方卸载指南。
尝试移动或删除 user/local 文件中的 Homebrew 文件,然后尝试使用自制软件主页上的常规 link 安装 brew!
顺便说一句,我没有尝试移动,但我很确定它应该可以。
注意:虽然您可能需要使用 sudo 进行操作
我遇到了同样的问题,下面的 link 真的对我有用 https://github.com/Homebrew/brew/issues/10368
尤其是 MrBenFTW 于 2021 年 2 月发表的评论