修复 brew doctor warnings/errors

Fixing brew doctor warnings/errors

我最近安装了 Homebrew 和 RVM。但是,当我尝试将 Ruby 的新版本安装到 RVM 中时:...

rvm install 2.2

我收到以下错误:

Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.9/x86_64/ruby-2.2.0.tar.bz2
Checking requirements for osx.
ERROR: '/usr/local/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.

所以我运行医生命令查看错误并看到:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/local/bin 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.

我在其他各种目录中发现了同样的问题:

/Library/Caches/Homebrew
/usr/local/Cellar
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/opt
/usr/local/share
/usr/local/share/man
/usr/local

当我安装 RVM 时,我将单个用户安装到非管理员帐户中。我将使用这个非管理员帐户作为我的开发帐户。这样可以吗,还是我应该使用管理员帐户进行开发?我 运行 遇到各种权限类型问题;例如,尝试安装 gem,因为写入权限失败,现在我质疑开发代码的正确方法是什么,而不是管理员,或者我应该是管理员?

我打算开始使用 chown 来修复这些错误,即

chown $USER -R /usr/local/bin

但是,这让我很担心。我想将所有这些系统目录的所有者更改为我的非管理员帐户吗?在我继续之前,我只是想重新确认运行ce,只是感觉不对。 (PS;这是 chown 的正确用法吗?)

我看过其他建议使用 sudo 的文章,但我也看过一些文章说您不应该使用 sudo。谨慎起见,我宁愿不使用 sudo。

谢谢。

Homebrew FAQ.

很好地涵盖了其中大部分问题

Do I want to be changing the owner of all these system directories to my non admin account?

系统库未安装到 /usr/local。 Apple 不会在全新安装中包含该目录。很可能是其他一些安装程序以 root 或其他用户身份将东西放在那里。

I've seen other articles that suggest using sudo, but I've also seen artciles that say you shouldn't use sudo.

Homebrew 应该sudo 一起使用,但它假定用户是管理员并且有权使用/usr/local。如果您只是指用 chown 修复权限,那将需要 sudo(和管理员帐户)。