【问题标题】:What does "brew link" do?“酿造链接”有什么作用?
【发布时间】:2016-01-20 23:39:52
【问题描述】:

当我运行 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 究竟做了什么?

【问题讨论】:

标签: homebrew


【解决方案1】:

Homebrew 可以允许安装多个版本的公式。例如,有公式称为nodenode@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 指向安装在 Cellar 中的早期版本 (keg-only)。

【讨论】:

  • brew link --force --overwrite node@10
  • @themefield 嗨,我已经在 gcc@9gccalready 安装的情况下尝试过这个,但 brew info gcc@9 没有返回 => 仅您在上面提到的关于桶的警告。我想知道你是否知道在这种情况下如何告诉系统使用旧的 gcc v9?
【解决方案2】:

brew link 为您在Cellar 中手动执行的安装创建符号链接。这使您可以灵活地自行安装东西,但仍然让那些作为依赖项参与到 homebrew 公式中。

请参阅FAQ 了解更多信息。

您应该按照这些说明并在它列出的条目上运行brew link

【讨论】:

  • 我想要一个更底层的答案:这些符号链接在哪里?酒窖在哪里/在哪里?如果您对此信息进行澄清,我愿意接受此答案。
  • 符号链接可以用ls 视为普通链接。 ls -lh /usr/local/bin/python => /usr/local/bin/python -> ../Cellar/python/3.6.4_3/bin/python。对于 homebrew 管理的所有符号链接的完整参考,我也很好奇。酒窖是所有 Homebrew 软件包所在的地方。它在/usr/local/Cellar下。
猜你喜欢
  • 2014-11-20
  • 2013-09-13
  • 1970-01-01
  • 1970-01-01
  • 2012-11-08
  • 1970-01-01
  • 2012-06-07
  • 2017-07-19
  • 2016-03-28
相关资源
最近更新 更多