Permissions 安装Homebrew时出现权限错误

Permissions 安装Homebrew时出现权限错误,permissions,osx-mavericks,homebrew,Permissions,Osx Mavericks,Homebrew,我正在尝试在运行OS X 10.9.2的较旧、维护不太好的机器上安装自制软件。当我使用自制网站上的自动安装脚本时: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 我收到一系列权限错误: ==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew ==> Downloading and ins

我正在尝试在运行OS X 10.9.2的较旧、维护不太好的机器上安装自制软件。当我使用自制网站上的自动安装脚本时:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
我收到一系列权限错误:

==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 207213, done.
remote: Compressing objects: 100% (55712/55712), done.
remote: Total 207213 (delta 150324), reused 207201 (delta 150315)
Receiving objects: 100% (207213/207213), 43.70 MiB | 5.35 MiB/s, done.
Resolving deltas: 100% (150324/150324), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
error: unable to unlink old 'Library/Homebrew/extend/ENV/shared.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/extend/ENV/std.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/extend/ENV/super.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/hooks/bottles.rb' (Permission denied)
error: unable to create file Library/Homebrew/language/go.rb (Permission denied)
error: unable to create file Library/Homebrew/language/haskell.rb (Permission denied)
error: unable to unlink old 'Library/Homebrew/language/python.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/requirements/fortran_dependency.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/requirements/language_module_dependency.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/requirements/ld64_dependency.rb' (Permission denied)
error: unable to create file Library/Homebrew/requirements/maximum_macos_requirement.rb (Permission denied)
error: unable to unlink old 'Library/Homebrew/requirements/minimum_macos_requirement.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/requirements/mpi_dependency.rb' (Permission denied)
error: unable to create file Library/Homebrew/requirements/osxfuse_dependency.rb (Permission denied)
error: unable to unlink old 'Library/Homebrew/requirements/python_dependency.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/requirements/x11_dependency.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/utils/inreplace.rb' (Permission denied)
error: unable to unlink old 'Library/Homebrew/utils/json.rb' (Permission denied)
error: unable to create file Library/Homebrew/utils/popen.rb (Permission denied)
error: unable to unlink old 'Library/Homebrew/vendor/okjson.rb' (Permission denied)
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master
为什么会出现这些问题?据我所见(基于上述代码片段的第一行),Homebrew的安装脚本在该目录上执行
chmod
,以授予其适当的权限


如何解决此问题?

您需要将权限重置为
/usr/local

brew update
brew upgrade
brew cleanup
brew install node
brew link --overwrite node
sudo chown -R `whoami` /usr/local

在某些情况下,
brew更新
会失败并出现类似错误。在这种情况下,首先使用
chown
重置您的权限,然后运行
brew update
和其他命令。

在使用旧的、半卸载的brew的计算机上安装/更新brew时,我遇到了相同的错误。我先是跟着

然后发出install命令

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@帕克工作得很有魅力。谢谢sudo chown-R
whoami
/usr/local
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"