Ruby 2.2.3 in 2020

793 Views Asked by At

Ruby 2.2.3 has been dead for a while and yet I've been asked to look at a legacy project in order to update and fix it. I can't get 2.2.3 to install in order to get a local env up and running on either MacOS or Ubuntu.

The error seems to be down to an openssl rubygems issue:

from rubygems.install.log

Exception `LoadError' at /Users/user/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems.rb:1222 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/user/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems.rb:1231 - cannot load such file -- rubygems/defaults/ruby
/Users/user/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)

Does anyone have any suggestions on how proceed?

2

There are 2 best solutions below

1
Phil-6 On BEST ANSWER

On MacOS using rbenv instead of rvm solves this issue and has allowed me to move onto another host of dependency issues.

0
Kritik Sharma On
$ brew update && brew upgrade 
$ brew doctor 

Solve all brew doctor warnings, then proceed further

$ brew uninstall ruby
$ brew install rbenv 
$ brew install ruby-build 
$ echo 'export RBENV_ROOT=/usr/local/var/rbenv' >> ~/.bash_profile
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ rbenv install -l
$ rbenv install 2.2.3
$ rbenv global 2.2.3