Error installing Ruby 2.3.8 in OSX 10.15.2 Catalina using RVM; OpenSSL not found
Asked Answered
B

3

14

Error

Error running 'env GEM_HOME=/Users/john/.rvm/gems/ruby-2.3.8@global

I encountered this error while I was trying to install ruby 2.3.8 in MacOs Catalina 10.15.2

$ rvm install 2.3.8


Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.3.8.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/[email protected]/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/john/.rvm/rubies/ruby-2.3.8, this may take a while depending on your cpu(s)...
ruby-2.3.8 - #downloading ruby-2.3.8, this may take a while depending on your connection...
ruby-2.3.8 - #extracting ruby-2.3.8 to /Users/john/.rvm/src/ruby-2.3.8 - please wait
ruby-2.3.8 - #configuring - please wait
ruby-2.3.8 - #post-configuration - please wait
ruby-2.3.8 - #compiling - please wait
ruby-2.3.8 - #installing - please wait
ruby-2.3.8 - #making binaries executable - please wait
ruby-2.3.8 - #downloading rubygems-3.0.8
ruby-2.3.8 - #extracting rubygems-3.0.8 - please wait
ruby-2.3.8 - #removing old rubygems - please wait
ruby-2.3.8 - #installing rubygems-3.0.8 - please wait

Error running 'env GEM_HOME=/Users/john/.rvm/gems/ruby-2.3.8@global GEM_PATH= /Users/john/.rvm/rubies/ruby-2.3.8/bin/ruby -d /Users/john/.rvm/src/rubygems-3.0.8/setup.rb --no-document',

please read /Users/john/.rvm/log/1583757882_ruby-2.3.8/rubygems.install.log

Log output

$ cat /Users/john/.rvm/log/1583757882_ruby-2.3.8/rubygems.install.log


...skipping...
Exception `LoadError' at /Users/john/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/rubygems.rb:1242 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/john/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/rubygems.rb:1251 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /Users/john/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- did_you_mean
/Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/specification.rb:2481:in `to_ruby'
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:405:in `install_default_bundler_gem'
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:167:in `execute'
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/command.rb:321:in `invoke_with_build_args'
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:184:in `process_args'
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:148:in `run'
        from /Users/john/.rvm/src/rubygems-3.0.8/lib/rubygems/gem_runner.rb:59:in `run'
        from setup.rb:41:in `<main>'

Gist is

`require': cannot load such file -- openssl (LoadError)

I tried

Digging deeper, I found that newer versions of OSX deprecated OpenSSL, leaving many dependencies broken. You need to reinstall ruby, but specify exactly where your OpenSSL libraries are. If you're using RVM then that looks like:

$ brew install openssl
$ rvm reinstall 2.3.8 --with-openssl-dir=`brew --prefix openssl`

but did not work, the error did not change.

Then I tried

$ rvm reinstall 2.3.8 --rubygems 2.6.6 --with-openssl-dir=`brew --prefix openssl`


Error running '__rvm_with ruby-2.3.8@myapp gemset_pristine',
please read /Users/john/.rvm/log/1583758650_ruby-2.3.8/gemset.pristine-ruby-2.3.8@myapp

says, nokogiri is not installed,

$ gem install nokogiri -v=1.10.4

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

Any idea how to solve this?

Boggs answered 9/3, 2020 at 11:15 Comment(2)
I haven't used RVM in years but it should have a verbose option (-v?) which should tell you more about what actually failed.Darnel
I'm trying to do the same thing here. The problem is Homebrew is installing openssl 1.1 Ruby 2.3 is not compatible with openssl 1.1 you need openssl 1.0. I managed to install following the instructions here github.com/rbenv/ruby-build/issues/1353#issuecomment-573414540.Glaciate
B
10

I tried everything and came to conclusion that there is problem with the binary of ruby 2.3.8 RVM has. The I removed RVM from my system and start using rbenv.

With Homebrew

$ brew install rbenv
$ rbenv init
# Do as it says
$ rbenv install 2.3.8

also make sure you the use the bundler specified in your legacy code's Gemfile.lock

Boggs answered 11/3, 2020 at 3:0 Comment(0)
N
3

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

You might try this:

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

Copied from

Necropolis answered 18/12, 2020 at 11:27 Comment(0)
F
0
  • install rvm
  • run this command
brew install rbenv/tap/[email protected]

PKG_CONFIG_PATH=/usr/local/Cellar/[email protected]/1.0.2t/lib/pkgconfig \
rvm install 2.3.8 \
--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

this will add [email protected] and install ruby 2.3.8 version

Fractostratus answered 4/11, 2022 at 9:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.