rvm / rvm

Ruby enVironment Manager (RVM)
https://rvm.io
Other
5.11k stars 1.02k forks source link

Ruby rvm install ruby 2.3.1 #4889

Open tilipim123 opened 4 years ago

tilipim123 commented 4 years ago

0

When running rvm install "ruby-2.3.1" I got this error:

Error running 'env GEM_HOME=/Users/caiofelipe/.rvm/gems/ruby-2.3.1@global GEM_PATH= /Users/caiofelipe/.rvm/rubies/ruby-2.3.1/bin/ruby -d /Users/caiofelipe/.rvm/src/rubygems-3.0.8/setup.rb --no-document',
please read /Users/caiofelipe/.rvm/log/1584630897_ruby-2.3.1/rubygems.install.log

The log (rubygems.install.log) has this:

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

rvm reinstall ruby-2.3.1 --with-openssl-dir='/usr/local/opt/openssl' worked for me..

ibantoo commented 4 years ago

@MathewsMacedo is that work well now after you found out how to fix that ? I have same issue also?

tilipim123 commented 4 years ago

it worked for me too

pirj commented 4 years ago

Doesn't help me. It seems that Ruby pre-2.3 require OpenSSL pre-1.1, and it's no longer in Homebrew in macOS. Users of the other operating systems might not experience this issue. macOS itself seems to ship with LibreSSL 2.6.5 (hard fork of OpenSSL), and for me, it's hard to tell which OpenSSL version it corresponds to, I've heard of major divergence of API between the two in recent versions.

Might make sense to check if MacPorts still provide access to pre-1.1 OpenSSL.

surbhitawasthi commented 4 years ago

The issue got resolved for me by moving to openssl-1.0. I used the following commands

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb -f

followed by

rvm reinstall ruby-2.3.1 --with-openssl-dir='/usr/local/Cellar/openssl/1.0.2t'

Note: The --with-openssl-dir option will take the path where openssl-1.0 is installed

aruprakshit commented 4 years ago

I tried rvm reinstall ruby-2.3.3 --with-openssl-dir='/usr/local/opt/openssl' but getting same error.

aruprakshit@arups-iMac ~ % cat /Users/aruprakshit/.rvm/log/1599406839_ruby-2.3.3/rubygems.install.log
Exception `LoadError' at /Users/aruprakshit/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/rubygems.rb:1241 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/aruprakshit/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/rubygems.rb:1250 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /Users/aruprakshit/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- did_you_mean
/Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/specification.rb:2481:in `to_ruby'
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:405:in `install_default_bundler_gem'
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:167:in `execute'
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/command.rb:321:in `invoke_with_build_args'
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:184:in `process_args'
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:148:in `run'
    from /Users/aruprakshit/.rvm/src/rubygems-3.0.8/lib/rubygems/gem_runner.rb:59:in `run'
    from setup.rb:41:in `<main>'
abhilashak commented 4 years ago

If you are trying to install Ruby 2.3.1 in New Mac 2020

Mac OS Catalina (NEW Version) | rvm 1.29.1 (NEW Version) | Ruby 2.3.1 (OLD Version)

$ rvm install 2.3.1 --with-openssl-dir=$HOME/.rvm/usr
$ rvm reinstall ruby-2.3.1 --with-openssl-dir='/usr/local/opt/openssl'

This NOT works for me.

Installing Old rvm version does it for me.

\curl -sSL https://get.rvm.io | bash -s 1.27.0

Then do:

rvm install 2.3.1

It install required software itself:

Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: openssl - please wait
Certificates in '/usr/local/etc/openssl@1.1/cert.pem' are already up to date.
Requirements installation successful.

@pirj Yes. This is of course not an issue with RVM version.The older version of rvm works in a different way! That's enough for us to make a try. It installed ruby without any error.

Ruby installation is successful with above steps. But still I get this error when I am trying to install openssl Gem.

pirj commented 4 years ago

Try this:

brew install rbenv/tap/openssl@1.0
PKG_CONFIG_PATH=/usr/local/Cellar/openssl@1.0/1.0.2t/lib/pkgconfig rvm install 2.3.1 --with-openssl-dir=/usr/local/Cellar/openssl@1.0/1.0.2t --with-openssl-lib=/usr/local/Cellar/openssl@1.0/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/openssl@1.0/1.0.2t/include --rubygems ignore
pirj commented 4 years ago

It actually has nothing to do with RVM. This brew tap to install older OpenSSL is provided by a similar tool, rbenv, and I see no good reason for RVM to replicate that. Maybe fork to be sure it's still there and update the documentation.

It's system dependencies, and there's no straightforward way to install such an old OpenSSL version on a modern macOS. What's most important, it's macOS-specific, and RVM is not.

swistak commented 4 years ago

If anyone stumbles upon this. The most consistent way to install old rubies on Mojave (10.14.6) using homebrew

brew install rbenv/tap/openssl@1.0
export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig"
rvm_rubygems_version=2.7.3 rvm reinstall ruby-2.2.10 --with-openssl-dir=/usr/local/Cellar/openssl@1.0/1.0.2t --with-openssl-lib=/usr/local/Cellar/openssl@1.0/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/openssl@1.0/1.0.2t/include
sidneip commented 3 years ago

rvm install ruby-2.3.1 --with-openssl-dir=$rvm_path/usr

barkiiqbal commented 3 years ago

rvm reinstall ruby-2.3.1 --with-openssl-dir='/usr/local/opt/openssl' worked for me..

After installing openssl@1.0 I run the below command and it works like a charm. rvm reinstall ruby-2.3.1 --with-openssl-dir='/usr/local/opt/openssl@1.0'

deXterbed commented 3 years ago

Try:

brew install rbenv/tap/openssl@1.0
CFLAGS="-Wno-error=implicit-function-declaration" rvm reinstall ruby-2.2.5 --with-openssl-dir='/usr/local/opt/openssl@1.0'
hrabkin commented 3 years ago

Installing OpenSSL 1.0 means to be affected by heartbleed

Affected software | OpenSSL (1.0.1)

arafiu-rpx commented 3 years ago

Try

CFLAGS="-Wno-error=implicit-function-declaration" rvm install ruby-2.3.1 --with-openssl-dir='/usr/local/opt/openssl@1.1'

@GRyabkin this is also working for me in my m1.

alexventuraio commented 1 year ago

Try this:

# brew install rbenv/tap/openssl@1.0 # I didn't use this
PKG_CONFIG_PATH=/usr/local/Cellar/openssl@1.0/1.0.2t/lib/pkgconfig rvm install 2.3.1 --with-openssl-dir=/usr/local/Cellar/openssl@1.0/1.0.2t --with-openssl-lib=/usr/local/Cellar/openssl@1.0/1.0.2t/lib --with-openssl-include=/usr/local/Cellar/openssl@1.0/1.0.2t/include --rubygems ignore

This worked for me on Mac OS Ventura 13.2.1 (22D68) Apple M1 Pro having OpenSSL 1.0 with this: