重新安装Homebrew的最佳/最安全方法是什么?

问题描述:

我在Homebrew中遇到权限问题:安装Node并尝试使用curl命令Homebrew告诉您使用npm安装npm后,由于EACCESS错误,该操作将失败.我检查了节点文件夹,并确定了以下权限:a)用户不拥有的权限(我必须将其扔掉)和b)没有写权限(我必须将其更改为chmod 755).

I am getting issues with permissions in Homebrew: After I installed Node and tried to install npm using the curl command Homebrew tells you to use, it would fail due to EACCESS errors. I checked the node folder and the permissions were a) unowned by a user (I had to chown it) and b) Had no write permissions (I had to chmod 755 it).

我已经解决了NPM的问题,但是我必须以sudo来运行其安装脚本(这很糟糕!).

I've fixed the issue with NPM, but I had to run its install script as sudo (which is bad!).

我假设我必须以root或类似的身份安装Homebrew.我希望重新安装能够解决此问题,但是找不到如何重新安装Homebrew的来源.

I assume I must have installed Homebrew as root or something similar. I am hoping that reinstallation will fix it, but I can't find a source on how to reinstall Homebrew.

当我在终端中重新运行安装程序时,我得到:

When I rerun the installer in Terminal I get:

/usr/local/.git already exists!

尝试运行命令 brew doctor 让我们知道您得到什么样的输出

Try running the command brew doctor and let us know what sort of output you get


要回答标题问题,这来自他们的常见问题解答:


edit: And to answer the title question, this is from their FAQ :

Homebrew不会在其前缀之外写入文件.所以通常你可以 只需rm -rf您安装它的文件夹.

Homebrew doesn’t write files outside its prefix. So generally you can just rm -rf the folder you installed it in.

因此,最好重新安装(按照他们最新的建议步骤进行操作).

So following that up with a clean re-install (following their latest recommended steps) should be your best bet.