嗨,我刚试过在我的mac上通过自制软件安装git - 出了点问题。我安装了mac app的github,但我尝试删除它。我系统中当前的git版本是:
Nielsk@~: $ git --version
git version 1.9.3 (Apple Git-50)
如果我尝试通过自制软件安装git会发生这种情况:
Nielsk@~: $ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.1.3.y
######################################################################## 100,0%
==> Pouring git-2.1.3.yosemite.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
The 'contrib' directory has been installed to:
/usr/local/share/git-core/contrib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
我怎么解决这个问题?
我也遇到了同样的问题。我认为我们应该更改可读权限,以确保“all”可以读取任何目录。所以我尝试了命令:sudo chown -R $USER:admin /usr/local
然后:brew link --overwrite git
它适用于我,希望它也适合你。
从高山脉,chown
的/usr/local
是不允许的。但是,您仍然可以更改/usr/local
中子目录的权限。
在我的情况下,我不得不在Frameworks
和/usr/local
创建sudo chown -R $(whom) Frameworks
。之后是brew doctor
所说的。
更好的方法是创建你需要的子目录并运行
sudo chown -R $(whoami) $(brew --prefix)/*
对于使用新El Capitan OS的用户,您需要更新您的权限:
打开终端并键入以下命令:
$ sudo chown -R $(whoami):admin /usr/local
$ brew doctor
$ brew update
$ brew link --overwrite git
上述解决方案适用于其他brew安装,如节点等。如果您开始安装,只需更换最后一行,但在brew安装期间遇到错误。
我安装permission denied
时遇到类似的git
错误,直到我清理完为止:
$brew doctor
..... << long output of issues, so you run:
$brew prune
$brew doctor
..... << less issues now, so manually clean up
$brew update
$brew install git
这也解决了你的错误吗?
我做了什么brew doctor
推荐,它帮助:
sudo mkdir -p /usr/local/sbin
sudo chown -R $(whoami) /usr/local/sbin
MacOS 10.14.4