运行 Brew Doctor 时的主要警告

Posted

技术标签:

【中文标题】运行 Brew Doctor 时的主要警告【英文标题】:Major Warnings when Running Brew Doctor 【发布时间】:2014-08-22 00:19:16 【问题描述】:

我运行brew doctor 并收到一些警告消息,我想我知道要采取哪些措施来修复,但想看看我是否走在正确的轨道上。以下是我收到的警告列表:

Warning: /usr/local/lib/pkgconfig isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/lib/pkgconfig

Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:

    /usr/local/share/man/mann

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libtcl8.6.dylib
    /usr/local/lib/libtk8.6.dylib

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/tcl.pc
    /usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
    /usr/local/lib/libtclstub8.6.a
    /usr/local/lib/libtkstub8.6.a

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:

    libyaml

对于第一种情况,我应该运行chown <user>/usr/local/lib/pkgconfig

Warning: /usr/local/lib/pkgconfig isn't writable.

    This can happen if you "sudo make install" software that isn't managed by
    by Homebrew. If a formula tries to write a file to this directory, the
    install will fail during the link step.

    You should probably `chown` /usr/local/lib/pkgconfig

然后chown <user>/usr/local/share/man/mann 发送下一条消息

Warning: Some directories in /usr/local/share/man aren't writable.
    This can happen if you "sudo make install" software that isn't managed
    by Homebrew. If a brew tries to add locale information to one of these
    directories, then the install will fail during the link step.
    You should probably `chown` them:

        /usr/local/share/man/mann

不确定如何处理这些有关删除文件的警告。 (???)

Warning: Unbrewed dylibs were found in /usr/local/lib.
    If you didn't put them there on purpose they could cause problems when
    building Homebrew formulae, and may need to be deleted.

    Unexpected dylibs:
        /usr/local/lib/libtcl8.6.dylib
        /usr/local/lib/libtk8.6.dylib

    Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
    If you didn't put them there on purpose they could cause problems when
    building Homebrew formulae, and may need to be deleted.

    Unexpected .pc files:
        /usr/local/lib/pkgconfig/tcl.pc
        /usr/local/lib/pkgconfig/tk.pc

    Warning: Unbrewed static libraries were found in /usr/local/lib.
    If you didn't put them there on purpose they could cause problems when
    building Homebrew formulae, and may need to be deleted.

    Unexpected static libraries:
        /usr/local/lib/libtclstub8.6.a
        /usr/local/lib/libtkstub8.6.a

最后运行brew link libyaml

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:

        libyaml

【问题讨论】:

【参考方案1】:

要解决权限问题,您可以chown -R your_username /usr/local 递归更改/usr/local 下所有内容的所有权。

你应该brew link libyaml

关于 dylibs 的警告告诉你,你有一个 Tcl/Tk 库安装到 /usr/local。如果您知道它是如何到达那里的并且您知道您不需要它,您可以卸载它。如果你不知道它是如何到达那里的,你可以重命名它的文件,这样构建就不会拾取它(如果你发现某些东西依赖于它们,你可以把它们放回去)。除非并且直到某些东西以与 Tk 相关的方式发生故障,否则将其留在原处可能很好;它可能永远不会给你带来麻烦。

【讨论】:

如果机器上有多个用户怎么办?当然,让一个用户拥有 /usr/local 的所有权是没有意义的。 在这种情况下,所有有权使用 Homebrew 安装软件的用户都必须具有对 Homebrew 前缀的写入权限。设置适当的组权限和 umask 应该可以正常工作。 Brewdo 是另一种使用专用 Homebrew 用户帐户的方法:github.com/zigg/brewdo 或者,用户可以在其用户文件夹中管理自己的安装。 谢谢蒂姆,这是有道理的。最好在 Homebrew 站点的安装帮助指南或常见问题解答中解释这些选项。介意我给他们发一个你评论的链接吗? 当然,我是 Homebrew 维护者。如果您想在github.com/Homebrew/homebrew/issues 上打开一个问题,那会很有帮助,谢谢!没有一个维护者在多用户配置中使用或测试 Homebrew(我认为这有点不寻常),所以我想花一点时间来确保它是健壮的,并具体弄清楚为组权限推荐哪些命令案例。【参考方案2】:

我通过运行sudo chown <user>/usr/local/lib/pkgconfigsudo chown <user>/usr/local/share/man/mann 解决了这个问题。

然后我删除了推荐的文件并运行brew link libyaml,一切都很好。

【讨论】:

以上是关于运行 Brew Doctor 时的主要警告的主要内容,如果未能解决你的问题,请参考以下文章

如何修复 brew doctor 警告

Brew Doctor 说:“警告:/usr/local/include 不可写。”

警告:可能的 EventEmitter - 运行“foundation new”时的节点警告

Flutter Doctor - 无法确定捆绑的 Java 版本

使用 python 时的警告信息

输入聊天消息时的Firebase警告[重复]