ruby-on-rails - 使用 Brew 安装 rbenv

标签 ruby-on-rails ruby macos homebrew rbenv

我正在尝试参加约翰霍普金斯大学的 Ruby 类(class)。 Mac OSX 设置说明要求我下载 Homebrew 软件,然后安装 rbenv。我已经从很久以前做过的事情中安装了 brew,所以这个问题可能是因为很久以前我搞砸了安装 ruby​​/brew。

这是给我问题的命令:brew install rbenv ruby​​-build 我得到的回应是这样的:

Warning: rbenv-0.4.0 already installed, it's just not linked
==> Installing dependencies for ruby-build: pkg-config, openssl
Error: Cannot link pkg-config
Another version is already linked: /usr/local/Cellar/pkg-config/0.28

更新:这是运行 brew doctor 后出现的内容:

Warning: /usr/local/bin isn't writable.

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

You should probably change the ownership and permissions of /usr/local/bin
back to your user account.
  sudo chown -R $(whoami) /usr/local/bin

Warning: /usr/local/share isn't writable.

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

You should probably change the ownership and permissions of /usr/local/share
back to your user account.
  sudo chown -R $(whoami) /usr/local/share

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 `sudo chown -R $(whoami)` them:
    /usr/local/share/man
    /usr/local/share/man/man1
    /usr/local/share/man/man5
    /usr/local/share/man/mann

Warning: Broken symlinks were found. Remove them with `brew prune`:
    /usr/local/bin/2to3-3.3
    /usr/local/bin/apm
    /usr/local/bin/atom
    /usr/local/bin/idle3.3
    /usr/local/bin/python3.3-32
    /usr/local/bin/pythonw3
    /usr/local/bin/pythonw3-32
    /usr/local/bin/pythonw3.3
    /usr/local/bin/pythonw3.3-32
    /usr/local/bin/pyvenv-3.3
    /usr/local/bin/subl

Warning: Python is installed at /Library/Frameworks/Python.framework

Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.

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/libMonoPosixHelper.dylib
    /usr/local/lib/libSFFileMonitor.32.dylib
    /usr/local/lib/libSFIPC.32.dylib
    /usr/local/lib/libSFIPC.I.dylib
    /usr/local/lib/libSFsqlite3.7.4.dylib
    /usr/local/lib/libSFSyncEngine.I.dylib
    /usr/local/lib/libtcl8.6.dylib
    /usr/local/lib/libtk8.6.dylib

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

Unexpected header files:
    /usr/local/include/fakemysql.h
    /usr/local/include/fakepq.h
    /usr/local/include/fakesql.h
    /usr/local/include/itcl.h
    /usr/local/include/itcl2TclOO.h
    /usr/local/include/itclDecls.h
    /usr/local/include/itclInt.h
    /usr/local/include/itclIntDecls.h
    /usr/local/include/itclMigrate2TclCore.h
    /usr/local/include/itclTclIntStubsFcn.h
    /usr/local/include/mysqlStubs.h
    /usr/local/include/node/ares.h
    /usr/local/include/node/ares_version.h
    /usr/local/include/node/nameser.h
    /usr/local/include/node/node.h
    /usr/local/include/node/node_buffer.h
    /usr/local/include/node/node_internals.h
    /usr/local/include/node/node_object_wrap.h
    /usr/local/include/node/node_version.h
    /usr/local/include/node/openssl/opensslconf.h
    /usr/local/include/node/uv-private/ngx-queue.h
    /usr/local/include/node/uv-private/stdint-msvc2008.h
    /usr/local/include/node/uv-private/tree.h
    /usr/local/include/node/uv-private/uv-bsd.h
    /usr/local/include/node/uv-private/uv-darwin.h
    /usr/local/include/node/uv-private/uv-linux.h
    /usr/local/include/node/uv-private/uv-sunos.h
    /usr/local/include/node/uv-private/uv-unix.h
    /usr/local/include/node/uv-private/uv-win.h
    /usr/local/include/node/uv.h
    /usr/local/include/node/v8-debug.h
    /usr/local/include/node/v8-preparser.h
    /usr/local/include/node/v8-profiler.h
    /usr/local/include/node/v8-testing.h
    /usr/local/include/node/v8.h
    /usr/local/include/node/v8stdint.h
    /usr/local/include/node/zconf.h
    /usr/local/include/node/zlib.h
    /usr/local/include/odbcStubs.h
    /usr/local/include/pqStubs.h
    /usr/local/include/tcl.h
    /usr/local/include/tclDecls.h
    /usr/local/include/tclOO.h
    /usr/local/include/tclOODecls.h
    /usr/local/include/tclPlatDecls.h
    /usr/local/include/tclThread.h
    /usr/local/include/tclTomMath.h
    /usr/local/include/tclTomMathDecls.h
    /usr/local/include/tdbc.h
    /usr/local/include/tdbcDecls.h
    /usr/local/include/tdbcInt.h
    /usr/local/include/tk.h
    /usr/local/include/tkDecls.h
    /usr/local/include/tkPlatDecls.h

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:
    rbenv

Warning: You have uncommitted modifications to Homebrew
If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
    cd /usr/local/Library && git stash && git clean -d -f

Warning: /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
    2to3-2.7
    easy_install
    easy_install-2.7
    idle
    idle2.7
    info
    infokey
    install-info
    makeinfo
    pydoc
    pydoc2.7
    python
    python-config
    python2.7
    python2.7-config
    pythonw
    pythonw2.7
    smtpd.py
    smtpd2.7.py
    tclsh
    tclsh8.5
    texi2dvi
    texi2pdf
    texindex
    wish
    wish8.5

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile`

新更新: 我做了 brew prune,更改了它建议的文件的所有权(其中一些找不到)。最后,当我运行 brew install rbenv ruby​​-build 时,出现以下错误:

Warning: rbenv-0.4.0 already installed, it's just not linked
Warning: ruby-build-20151028 already installed

下一步是执行 rbenv install 2.2.3,但是找不到 rbenv 命令。似乎安装以某种方式失败了。 which rbenv 也没有产生任何输出。

最佳答案

根据 brew doctor 的说法,您无法编辑它试图安装文件的目录。尝试运行

sudo chown -R $(whoami) /usr/local/bin

等等,就像 brew doctor 告诉你的那样:

You should probably change the ownership and permissions of /usr/local/share
back to your user account.
  sudo chown -R $(whoami) /usr/local/share

编辑: 您可能想查看输出的这一部分,以列出运行命令所需的内容。

You should probably `sudo chown -R $(whoami)` them:
    /usr/local/share/man
    /usr/local/share/man/man1
    /usr/local/share/man/man5
    /usr/local/share/man/mann

关于ruby-on-rails - 使用 Brew 安装 rbenv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34245749/

相关文章:

ruby-on-rails - Zeus 在使用 Rspec 进行测试时失败

ruby-on-rails - 有什么好方法可以在 WordPress 主题中包含 Rails Assets 样式表吗?

ruby-on-rails - 在 rails 中显示特定用户的博客文章

ruby-on-rails - Javascript 错误未知提供程序 : tProvider <- t after Rails minification Angularjs

ruby - 如何在 Ruby 中获取给定月份的天数,占年?

ruby - 配置 RSpec 以将 Capybara.javascript_driver 用于所有请求规范

在 OSX 上编译 ptrace() 程序

objective-c - 如何有一个按钮转换到 NSView 之外?

ios - Swift 2.0 beta 词典扩展

ruby-on-rails - heroku push 被拒绝,无法编译 Ruby/rails 应用程序