OS X Lion 上 Homebrew 的错误

seg*_*ult 18 homebrew osx-lion

我只是按照安装页面中的描述运行了 Homebrew 脚本。然后我brew doctor在终端中运行,它返回了几个错误。我不知道如何解决这些错误,请帮忙。

brew doctor

Error: 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/de
    /usr/local/share/man/de/man1
Error: You have Xcode 4.2, which is outdated.
Please install Xcode 4.3.
Error: 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/libcdt.5.dylib    /usr/local/lib/libcgraph.6.dylib    /usr/local/lib/libgraph.5.dylib    /usr/local/lib/libgvc.6.dylib    /usr/local/lib/libgvpr.2.dylib    /usr/local/lib/libpathplan.4.dylib    /usr/local/lib/libxdot.4.dylib
Error: 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/libcdt.pc    /usr/local/lib/pkgconfig/libcgraph.pc    /usr/local/lib/pkgconfig/libgraph.pc    /usr/local/lib/pkgconfig/libgvc.pc    /usr/local/lib/pkgconfig/libgvpr.pc    /usr/local/lib/pkgconfig/libpathplan.pc    /usr/local/lib/pkgconfig/libxdot.pc
Error: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    2to3

Consider amending your PATH so that /usr/local/bin
is ahead of /usr/bin in your PATH.
Run Code Online (Sandbox Code Playgroud)

seg*_*ult 27

经过大量的谷歌搜索和摆弄,我设法让它启动并运行。

首先,您需要使用“chown”使目录可写。

sudo chown $(whoami) /usr/local/share/man/de
sudo chown $(whoami) /usr/local/share/man/de/man1
Run Code Online (Sandbox Code Playgroud)

然后从 App Store 安装 Xcode 4.3,并从 Xcode->Preferences->Downloades->Components 安装命令行工具。然后设置 Xcode 4.3 的有效路径。

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)

GraphViz 中有一些意外的 dylib 和 .pc 文件。直接删除它们可能是安全的,但我选择备份它们,以防其他应用程序中断。要备份它们:

mkdir -p ~/brew-backup/lib/pkgconfig/
mv /usr/local/lib/*.*.dylib ~/brew-backup/lib/
mv /usr/local/lib/pkgconfig/*.pc ~/brew-backup/lib/pkgconfig/
Run Code Online (Sandbox Code Playgroud)

最后,修改系统PATH,使其/usr/local/bin出现在其他路径之前。

export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Run Code Online (Sandbox Code Playgroud)

通过运行检查是否没有更多错误

brew doctor
Run Code Online (Sandbox Code Playgroud)

更新brew以使包裹信息保持最新,您就可以开始了。

brew update
Run Code Online (Sandbox Code Playgroud)