2017-02-15 83 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