首页 > 解决方案 > 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

标签: macosterminalhomebrew

解决方案


你必须给 Homebrew 写里面的权利/usr/local。为此,运行的官方命令是:

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

有关详细信息,请阅读Homebrew的官方故障排除页面。

如果您尚未安装/usr/local依赖特定权限的应用程序,您还可以运行:

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

推荐阅读