Installation `brew链接未绑定`returns`/usr/local/sbin不可写`error

Installation `brew链接未绑定`returns`/usr/local/sbin不可写`error,installation,homebrew,Installation,Homebrew,我正在尝试使用brew命令进行安装 以下是brew安装未绑定的输出: Warning: unbound 1.6.7 is already installed, it's just not linked. You can use `brew link unbound` to link this version. 如您所见,我被要求使用brew link unbound链接到unbound 1.6.7 但我未能链接到它,因为我遇到以下错误: Linking /usr/local/Cellar/un

我正在尝试使用
brew
命令进行安装

以下是
brew安装未绑定的输出:

Warning: unbound 1.6.7 is already installed, it's just not linked.
You can use `brew link unbound` to link this version.
如您所见,我被要求使用
brew link unbound
链接到unbound 1.6.7

但我未能链接到它,因为我遇到以下错误:

Linking /usr/local/Cellar/unbound/1.6.7...
Error: Could not symlink sbin/unbound
/usr/local/sbin is not writable.
chown: /usr/local: Operation not permitted
我有另一个

答案
sudo chown-R$(whoami)/usr/local
产生以下错误:

Linking /usr/local/Cellar/unbound/1.6.7...
Error: Could not symlink sbin/unbound
/usr/local/sbin is not writable.
chown: /usr/local: Operation not permitted
我使用的是macOS High Sierra版本10.13.2


如何解决此问题?

以下命令解决了我的问题

sudo mkdir /usr/local/sbin
sudo chown -R $(whoami) /usr/local
brew link unbound

我认为您应该只运行
sudochown-R$(whoami)/usr/local/sbin
。如果完全覆盖/usr/local文件夹本身的所有权,则可能存在安全问题。我自己也不知道为什么/usr/local总是归root所有的所有含义,如果我不必这样做,我也不想打破这个假设。必须是一些受保护的系统文件夹:
TimComp:myfolder tim$sudo chown-R$(whoami)/usr/local/sbin chown:/usr/local/sbin:没有这样的文件或目录TimComp:myfolder tim$brew link--覆盖未绑定链接/usr/local/cillar/unbound/1.10.0。。。错误:无法将sbin/unbound/usr/local/sbin符号链接为不可写。