Homebrew:无法符号链接,/ usr / local / bin不可写[关闭]

本文翻译自:Homebrew: Could not symlink, /usr/local/bin is not writable [closed]

While installing tig , HomeBrew is displaying the following issues while installing a dependency: 在安装tigHomeBrew显示的是以下问题,而安装的依赖:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/a2x
/usr/local/bin is not writable.

You can try again using:
  brew link asciidoc

#1楼

参考:https://stackoom.com/question/1noCy/Homebrew-无法符号链接-usr-local-bin不可写-关闭


#2楼

Following Alex's answer I was able to resolve this issue; 按照亚历克斯的回答,我能够解决这个问题; seems this to be an issue non specific to the packages being installed but of the permissions of homebrew folders. 这似乎是一个非特定于正在安装的软件包但具有homebrew文件夹权限的问题。

sudo chown -R `whoami`:admin /usr/local/bin

For some packages, you may also need to do this to /usr/local/share or /usr/local/opt : 对于某些软件包,您可能还需要对/usr/local/share/usr/local/opt

sudo chown -R `whoami`:admin /usr/local/share
sudo chown -R `whoami`:admin /usr/local/opt

#3楼

Rather than running any particular command, I would recommend running brew doctor and taking all warnings seriously. 我不建议运行任何特定命令,而是建议运行brew doctor并认真对待所有警告。 There may be other problems you get stuck at which may not be captured in this question. 您可能会遇到其他问题,可能无法在此问题中捕获这些问题。

Also, as brew gets updated with time, particular commands may or may not remain valid. 此外,随着brew随时间更新,特定命令可能保持有效,也可能不保持有效。 brew doctor , however, will ensure that you get up to date troubleshooting. 但是, brew doctor会确保您获得最新的故障排除。


#4楼

If you go to the folder in finder, right click and select "Get Info" you can go to the "Sharing and Permissions" section for the folder and allow "Read & Write" to "everyone" 如果您在finder中转到该文件夹​​,右键单击并选择“获取信息”,您可以转到该文件夹​​的“共享和权限”部分,并允许“读取和写入”到“所有人”

This is what I do to make symlinks pass with this error. 这就是我用symlinks传递此错误的方法。 Also brew seems to reset the permissions on the folder also as if you hadn't altered anything brew也似乎重置了文件夹的权限,就好像你没有改变任何东西


#5楼

I've found the following relevant for Sophos Anti-Virus users: 我发现以下与Sophos Anti-Virus用户有关:

https://stackoverflow.com/a/32981184 https://stackoverflow.com/a/32981184

https://community.sophos.com/products/free-antivirus-tools-for-desktops/f/17/t/10029 https://community.sophos.com/products/free-antivirus-tools-for-desktops/f/17/t/10029

In short, Sophos is changing permissions of certain /usr/local directories. 简而言之,Sophos正在更改某些/ usr / local目录的权限。 Sophos has patched this and the fix is included with version 9.4.1. Sophos修补了此版本,修补程序包含在9.4.1版本中。


#6楼

I found for my particular setup the following commands worked 我发现在我的特定设置中,以下命令有效

brew doctor

And then that showed me where my errors were, and then this slightly different command from the comment above. 然后,这向我展示了我的错误,然后这与上面的评论略有不同。

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

你可能感兴趣的:(Homebrew:无法符号链接,/ usr / local / bin不可写[关闭])