“ brew link”有什么作用?


77

当我跑步时,brew doctor我得到一个常见警告:

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
# [...]

小桶取消链接是什么意思?究竟是brew link做什么的?


Answers:


38

brew link创建指向您在中手动执行的安装的符号链接Cellar。这使您可以灵活地自行安装事物,但仍可以使它们作为homebrew公式中的依赖项参与。

有关更多信息,请参见FAQ

您应遵循这些说明并brew link在其列出的条目上运行。


14
我在一个更底层的答案之后:这些符号链接位于哪里?地窖在哪里?如果您用此信息澄清,我想接受这个答案。
mbaytas

1
可以将符号链接ls视为普通链接。ls -lh /usr/local/bin/python=> /usr/local/bin/python -> ../Cellar/python/3.6.4_3/bin/python。对于自制软件管理的所有符号链接的完整参考,我也很好奇。地窖是所有Homebrew软件包所在的地方。它在下/usr/local/Cellar
安德烈·贝尔贡佐

24

自制程序可以允许安装多个版本的公式。例如,存在称为node和的公式node@10

$ brew info node@10
...
==> Caveats
node@10 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

如果我都nodenode@10安装,其中node为V11。我可以稍后决定激活早期版本brew link

$ brew unlink node

$ brew link node@10

$ cd /urs/local/bin
$ ls -l node
lrwxr-xr-x  1 user  admin  34 12 Dec 20:07 node -> ../Cellar/node@10/10.14.1/bin/node

这里的符号链接node指向keg-only安装在中的早期版本()Cellar


brew link --force --overwrite node@10
张巴斯
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.