问题描述
我正在尝试使用以下命令安装 ruby
I am trying to install ruby using below commands
source ~/.rvm/scripts/rvm
rvm install 2.3.7
我在 MacOs Catalina 10.15.5 中尝试安装 ruby 2.3.7 时遇到此错误
I encountered this error while I was trying to install ruby 2.3.7 in MacOs Catalina 10.15.5
rvm install 2.3.7
Warning, new version of rvm available '1.29.10', you are using older version '1.29.9'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with: rvm get VERSION (e.g. 'rvm get stable')
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.3.7.
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: openssl.
Updating certificates bundle '/usr/local/etc/[email protected]/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/pusingh/.rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
ruby-2.3.7 - #extracting ruby-2.3.7 to /Users/pusingh/.rvm/src/ruby-2.3.7.....
ruby-2.3.7 - #configuring...........................................................
ruby-2.3.7 - #post-configuration.
ruby-2.3.7 - #compiling..............................................................
ruby-2.3.7 - #installing.........
ruby-2.3.7 - #making binaries executable..
ruby-2.3.7 - #downloading rubygems-3.0.8
ruby-2.3.7 - #extracting rubygems-3.0.8......
ruby-2.3.7 - #removing old rubygems.........
$LANG was empty, setting up LANG=en_US.US-ASCII, if it fails again try setting LANG to something sane and try again.
ruby-2.3.7 - #installing rubygems-3.0.8..
Error running 'env GEM_HOME=/Users/pusingh/.rvm/gems/ruby-2.3.7@global GEM_PATH= /Users/pusingh/.rvm/rubies/ruby-2.3.7/bin/ruby -d /Users/pusingh/.rvm/src/rubygems-3.0.8/setup.rb --no-document',
please read /Users/pusingh/.rvm/log/1591718224_ruby-2.3.7/rubygems.install.log
这是 rubygems.install.log 文件的输出 -
this is the output of rubygems.install.log file -
Users/pusingh/.rvm/rubies/ruby-2.3.7/bin/ruby
current path: /Users/pusingh/.rvm/src/rubygems-3.0.8
GEM_HOME=/Users/pusingh/.rvm/gems/ruby-2.3.7@pm
PATH=/Users/pusingh/.rvm/usr/bin:/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/pusingh/.rvm/gems/ruby-2.3.7@pm/bin:/Users/pusingh/.rvm/gems/ruby-2.3.7@global/bin:/Users/pusingh/.rvm/rubies/ruby-2.3.7/bin:/Users/pusingh/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
GEM_PATH=/Users/pusingh/.rvm/gems/ruby-2.3.7@pm:/Users/pusingh/.rvm/gems/ruby-2.3.7@global
command(7): env GEM_HOME=/Users/pusingh/.rvm/gems/ruby-2.3.7@global GEM_PATH= /Users/pusingh/.rvm/rubies/ruby-2.3.7/bin/ruby -d /Users/pusingh/.rvm/src/rubygems-3.0.8/setup.rb --no-document
Exception `LoadError' at /Users/pusingh/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/rubygems.rb:1242 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/pusingh/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/rubygems.rb:1251 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /Users/pusingh/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- did_you_mean
/Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/specification.rb:2481:in `to_ruby'
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:405:in `install_default_bundler_gem'
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:167:in `execute'
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/command.rb:321:in `invoke_with_build_args'
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:184:in `process_args'
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:148:in `run'
from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/gem_runner.rb:59:in `run'
from setup.rb:41:in `<main>'
open ssl 版本是 OpenSSL> 版本LibreSSL 2.8.3
open ssl version is OpenSSL> versionLibreSSL 2.8.3
请帮忙,因为我不确定出了什么问题
Please help as I am not sure what is going wrong
推荐答案
参见 本期评论
看起来旧的 ruby 版本需要旧版本的 openSSL,并且必须使用指向 --with-openssl-dir
It looks like old ruby version requires an older version of openSSL and also it has to be build with that version pointing in --with-openssl-dir
你可以试试这个:
brew install rbenv/tap/[email protected]
PKG_CONFIG_PATH=/usr/local/Cellar/[email protected]/1.0.2t/lib/pkgconfig \
rvm install 2.3.7 \
--with-openssl-dir=/usr/local/Cellar/[email protected]/1.0.2t \
--with-openssl-lib=/usr/local/Cellar/[email protected]/1.0.2t/lib \
--with-openssl-include=/usr/local/Cellar/[email protected]/1.0.2t/include --rubygems ignore
这篇关于使用 RVM 在 mac os 10.15.5 Catalina 中安装 Ruby 2.3.7 时出错;未找到 OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!