ChatGPT解决这个技术问题 Extra ChatGPT

“酿造链接”有什么作用?

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


R
Rafa Viotti

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 下。
t
themefield

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@9 并已安装 gccbrew info gcc@9 没有返回 =>只有你上面提到的关于小桶的警告。我想知道你是否知道在这种情况下如何告诉系统使用旧的 gcc v9?