自制软件安装出现错误

时间:2018-12-10 15:40:00

标签: macos terminal homebrew

在安装自制软件时,我会看到此错误,有人可以解释发生了什么情况以及解决方案吗?

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
fatal: cannot copy '/usr/local/Cellar/git/2.19.1/share/git-core/templates/hooks/fsmonitor-watchman.sample' to '/usr/local/Homebrew/.git/hooks/fsmonitor-watchman.sample':
 Permission denied
Failed during: git init -q

1 个答案:

答案 0 :(得分:2)

您必须授予Homebrew在/usr/local内编写的权利。为此,要运行的官方命令是:

cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var opt Cellar Caskroom Frameworks

详细阅读官方troubleshooting page of Homebrew

如果您没有在/usr/local中安装依赖特定权限的应用程序,则还可以运行:

sudo chown -R $(whoami) /usr/local/*