RVM/rbenv RVM 安装 Ruby2.1.5 出现的问题

programmingworld · 2014年11月29日 · 最后由 msg7086 回复于 2014年11月30日 · 12400 次阅读

按照 Ruby-China wiki《如何快速正确的安装 Ruby, Rails 运行环境》上的步骤用 rvm 安装 ruby

MacOS 10.10.1 Xcode 6.1 Homebrew: 0.9.5 Rvm: rvm 1.26.3 (latest) by Wayne E. Seguin [email protected], Michal Papis [email protected] [https://rvm.io/]

步骤 1: rvm install 2.1.5 输出如下信息: Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.10/x86_64/ruby-2.1.5. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Installing requirements for osx. Updating system.......... Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libksba, openssl...... Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config libyaml readline libksba openssl', showing last 15 lines of /Users/wjf/.rvm/log/1417267175_ruby-2.1.5/package_install_autoconf_automake_libtool_pkg-config_libyaml_readline_libksba_openssl.log ++ case "$1" in ++ [[ -t 1 ]] ++ return 1 ++ printf %b 'There were package installation errors, make sure to read the log.

Try brew tap --repair and make sure brew doctor looks reasonable.

Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installationn\' There were package installation errors, make sure to read the log.

Try brew tap --repair and make sure brew doctor looks reasonable.

Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation ++ case "$_system_version" in ++ return 1 Requirements installation failed with status: 1. wjfdeMBP:~ wjf$ brew tap --repair Pruned 0 dead formulae

步骤 2: 根据上述信息查看了日志文件 package_install_autoconf_automake_libtool_pkg-config_libyaml_readline_libksba_openssl.log 内容如下: [2014-11-29 21:29:08] requirements_osx_brew_libs_install requirements_osx_brew_libs_install () { brew unlink "$@" || true; brew install "$@" || { typeset ret=$?; rvm_warn "There were package installation errors, make sure to read the log.

Try `brew tap --repair` and make sure `brew doctor` looks reasonable.

Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation"; case "$_system_version" in 10.6) rvm_warn " On OSX 10.6 instead of command line tools install: https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.6.pkg" ;; esac; return $ret } } current path: /Users/wjf PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/wjf/.rvm/bin: command(9): requirements_osx_brew_libs_install autoconf automake libtool pkg-config libyaml readline libksba openssl ++ brew unlink autoconf automake libtool pkg-config libyaml readline libksba openssl Error: No such keg: /usr/local/Cellar/autoconf ++ true ++ brew install autoconf automake libtool pkg-config libyaml readline libksba openssl ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/autoconf-2.69.yosemite.bottle.1.tar.gz ==> Pouring autoconf-2.69.yosemite.bottle.1.tar.gz 🍺 /usr/local/Cellar/autoconf/2.69: 70 files, 3.1M ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/automake-1.14.1.yosemite.bottle.tar.gz Error: Failed to download resource "automake" Download failed: https://downloads.sf.net/project/machomebrew/Bottles/automake-1.14.1.yosemite.bottle.tar.gz Warning: Bottle installation failed: building from source. ==> Downloading http://ftpmirror.gnu.org/automake/automake-1.14.1.tar.gz Trying a mirror... ==> Downloading http://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.gz ==> ./configure --prefix=/usr/local/Cellar/automake/1.14.1 ==> make install 🍺 /usr/local/Cellar/automake/1.14.1: 131 files, 3.2M, built in 12.7 minutes ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libtool-2.4.2.yosemite.bottle.3.tar.gz ==> Pouring libtool-2.4.2.yosemite.bottle.3.tar.gz ==> Caveats In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: glibtool and glibtoolize. ==> Summary 🍺 /usr/local/Cellar/libtool/2.4.2: 69 files, 2.5M ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-0.28.yosemite.bottle.2.tar.gz Error: Failed to download resource "pkg-config" Download failed: https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-0.28.yosemite.bottle.2.tar.gz Warning: Bottle installation failed: building from source. ==> Downloading http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz Trying a mirror... ==> Downloading http://fossies.org/linux/misc/pkg-config-0.28.tar.gz Error: Failed to download resource "pkg-config" Download failed: http://fossies.org/linux/misc/pkg-config-0.28.tar.gz ++ typeset ret=1 ++ rvm_warn 'There were package installation errors, make sure to read the log.

Try brew tap --repair and make sure brew doctor looks reasonable.

Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation' ++ rvm_pretty_print stdout ++ case "${rvm_pretty_print_flag:=auto}" in ++ case "${TERM:-dumb}" in ++ case "$1" in ++ [[ -t 1 ]] ++ return 1 ++ printf %b 'There were package installation errors, make sure to read the log.

Try brew tap --repair and make sure brew doctor looks reasonable.

Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installationn\' There were package installation errors, make sure to read the log.

Try brew tap --repair and make sure brew doctor looks reasonable.

Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation ++ case "$_system_version" in ++ return 1

根据上面日志看,rvm 在开始下载 autoconf,automake,libtool 时都有出错,但进行了重试后成功了, 但是到了下载 pkg-config 时彻底失败了。

在网上找了半天也没找到解决方法,后来想用 rvm 安装其它 ruby 版本或者使用 rbenv,但是这个问题毕竟还是没搞清楚,不想放弃,望各位大神指点啊!

先翻墙试试。

问题解决: 安装 xcode 命令行工具:command line tools 方法:在终端执行命令 xcode-select --install

安装完命令行工具后再执行 rvm install 2.1.5 一切顺利。并且 Installing required packages: ...是从之前失败的 pkg-config 开始的。

我是一个 mac os 的新手,这也算是一个小小的经验积累吧。与此问题相关的一些其它技术细节还望各位大神指点!!!

另外想问一下 xcode 中安装的命令行工具,和安装 ruby 需要的那些依赖包是什么关系呢?为什么安装了命令行工具后那些依赖的包就可以顺利的安装完成?

这些工具缺失所以他去 SF.net 抓,然后被墙。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号