安装HomeBrew 失败的解决方案(Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!)

在安装HomeBrew(或者安装成功 执行相关指令)时遇到错误提示:

Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Library/Taps/homebrew/homebrew-core --config core.autocrlf=false --depth=1 -q
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q

解决方案:

在终端中依次执行sudo chown -R apple:staff *brew doctor两个命令如下图:

localhost:~ sant$ sudo chown -R apple:staff *
localhost:~ sant$ brew doctor

待指令执行结束,homebrew 也就修复好了。

有小伙伴反应在执行

sudo chown -R apple:staff 

命令时 会提示 chown: apple: illegal user name

出现这个提示的原因是找不到apple 这个用户

解决方案也很简单:

在终端中执行  whoami 命令,查询当前用户的名称,

将 sudo chown -R apple:staff  中的apple 替换成查询出的用户名,运行该命令;

例如我的设备查出来的名称为 sant

在终端中执行

sudo chown -R sant(你设备的当前用户名称):staff

待指令运行结束,继续后面的操作。

附 homebrew常用操作:

brew install xxx           安装xxx

brew uninstall xxx       卸载xxx

brew update  xxx         更新xxx

brew doctor                 修复brew

原文链接:https://blog.csdn.net/auccy/article/details/54620454

原文地址:https://www.cnblogs.com/zmdComeOn/p/11990079.html