删除/usr/local/bin的内容后,无法重新安装或卸载Homebrew [英] Can't reinstall or uninstall Homebrew after blowing away contents of /usr/local/bin

查看:457
本文介绍了删除/usr/local/bin的内容后,无法重新安装或卸载Homebrew的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从/usr/local/bin文件夹中删除了所有内容(包括"brew").自制软件不再工作了,我似乎陷入了困境.当我尝试安装时说:

I removed ALL content from /usr/local/bin folder (including 'brew'). Homebrew isn't working anymore and I seem to be stuck in a limbo. When I try to install it says:

似乎已经安装了Homebrew.如果您的意图是 重新安装您应该在运行此安装程序之前执行以下操作 再次: ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall )"

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)"

当我运行给定的卸载命令时,它说:

When I run the given uninstall command it says:

无法找到Homebrew!

Failed to locate Homebrew!

背景

当我按照以下指南尝试删除node.js时,出现了问题: https://stackoverflow.com/a/11178106/1736012

The problem arose when I attempted to remove node.js by following this guide: https://stackoverflow.com/a/11178106/1736012

要完全卸载node + npm,请执行以下操作:

To completely uninstall node + npm is to do the following:

  1. 转到/usr/local/lib并删除任何节点和node_modules
  2. 转到/usr/local/include并删除任何节点和node_modules目录
  3. 如果您是通过brew install节点安装的,则在终端中运行brew brew节点
  4. 检查您的主目录中是否有任何本地或lib或 包括文件夹,然后从那里删除任何节点或node_modules
  5. 转到/usr/local/bin并删除任何节点可执行文件
  1. go to /usr/local/lib and delete any node and node_modules
  2. go to /usr/local/include and delete any node and node_modules directory
  3. if you installed with brew install node, then run brew uninstall node in your terminal
  4. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
  5. go to /usr/local/bin and delete any node executable

特别是5个不好!这就是导致我删除/usr/local/bin下的所有内容的原因.因此,brew doctor将不起作用(不再识别酿制法).布鲁尔在此之前做得很好.

Especially 5 was bad! That's what led me to remove everything under /usr/local/bin. So brew doctor won't work (brew isn't recognized anymore). Brew worked fine before this.

我尝试过的事情

这也不起作用,因为缺少brew:

This does not work either as brew is missing:

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 .这是: https://gist.github.com/SteveBenner/11254428 .它们都不起作用(都假定存在brew命令)...

I tried various scripts like this one for example: https://apple.stackexchange.com/a/85481. And this: https://gist.github.com/SteveBenner/11254428. None of them is working (both assumes that brew command is there)...

我该怎么做才能重新安装Homebrew,使其能够像以前一样工作?

What can I do to re install Homebrew so that it works as before??

推荐答案

这应该带回有效的brew命令:

This should bring back a working brew command:

cd /usr/local
git init
git remote add origin https://github.com/Homebrew/homebrew
git pull origin master

接下来,我将检查brew doctor的输出,看看是否存在重大问题.如果要完全卸载,请在homebrewgithub Wiki上有官方的卸载指南.

Next I would check the output of brew doctor and see if there are major problems. There is an official uninstalling guide on homebrew's github wiki in case you want to completely uninstall.

这篇关于删除/usr/local/bin的内容后,无法重新安装或卸载Homebrew的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆