2017-02-15 116 views
2

我正在运行OSX(10.12.3),并且安装了Ruby(2.2.2),它工作正常。我正在尝试使用RVM升级到2.2.6。安装似乎很好。在安装Ruby 2.2.6时与macOS Sierra发生RVM问题

- rvm install 2.2.6 
Searching for binary rubies, this might take some time. 
No binary rubies available for: osx/10.12/x86_64/ruby-2.2.6. 
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. 
Checking requirements for osx. 
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date. 
Requirements installation successful. 
Installing Ruby from source to: /location/.rvm/rubies/ruby-2.2.6, this may take a while depending on your cpu(s)... 
ruby-2.2.6 - #downloading ruby-2.2.6, this may take a while depending on your connection... 
ruby-2.2.6 - #extracting ruby-2.2.6 to /location/.rvm/src/ruby-2.2.6.... 
ruby-2.2.6 - #configuring.......................................................... 
ruby-2.2.6 - #post-configuration. 
ruby-2.2.6 - #compiling........................................................... 
ruby-2.2.6 - #installing.......... 
ruby-2.2.6 - #making binaries executable.. 
ruby-2.2.6 - #downloading rubygems-2.6.10 
ruby-2.2.6 - #extracting rubygems-2.6.10..... 
ruby-2.2.6 - #removing old rubygems......... 
$LANG was empty, setting up LANG=en_US, if it fails again try setting LANG to something sane and try again. 
ruby-2.2.6 - #installing rubygems-2.6.10..................... 
ruby-2.2.6 - #gemset created /location/.rvm/gems/[email protected] 
ruby-2.2.6 - #importing gemset /location/.rvm/gemsets/global.gems................................................ 
ruby-2.2.6 - #generating global wrappers........ 
ruby-2.2.6 - #gemset created /location/.rvm/gems/ruby-2.2.6 
ruby-2.2.6 - #importing gemsetfile /location/.rvm/gemsets/default.gems evaluated to empty gem list 
ruby-2.2.6 - #generating default wrappers........ 
ruby-2.2.6 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). 
Install of ruby-2.2.6 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri 

但是,当我尝试下面的命令,我会得到一些错误。

- bundle 
-bash: bundle: command not found 
    - gem install bundler 
ERROR: While executing gem ... (Gem::Exception) 
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources  

所以,虽然安装似乎很好,但它不能要求openssl时试图安装任何宝石。这可能是什么问题,我该如何解决它?

回答

0

我试图清除整个RVM和干净的重新安装,这没有帮助。使用来自here的phq的答案,我设法让它工作。

rvm remove 2.2.6 
rvm pkg install openssl 
rvm install 2.2.6 --with-openssl-dir=$HOME/.rvm/usr 
gem install bundler 
bundle 

它可能不是最好的解决方案,因为它手动加载openssl,但它似乎是目前唯一适用于我的解决方案。

1

如果你还没有安装Homebrew,你应该继续尝试。正如他们所说,“Homebrew安装了苹果公司所不需要的东西”,在你的情况下,它是openssl。

  1. 安装家酿:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. 将OpenSSL安装:brew install openssl
  3. 尝试重新安装捆绑:gem install bundler

为了避免在将来出现问题,我建议你看一看RVM Autolibs。它会使用Homebrew或其他管理器自动安装您需要的任何依赖项。如果你不想阅读文档,只需运行:rvm autolibs enable && rvm autolibs packages && rvm autolibs homebrew,你会没事的。

+0

我使用Homebrew并在当时安装了OpenSSL。此外,我有autolibs启用(默认情况下),似乎有一些问题,导致它没有正确配置autossl(从我的答案可以看出)。 – mpartan