mlo
mlo

Reputation: 81

Tried reinstalling Ruby but RubyGem failed to install

Mac OSX user new to Ruby on Rails. I'm trying to reinstall Ruby 2.0.0 because there's some problem with RubyGem, which stopped me from installing Rails. Near the end of the reinstall I got an error message saying RubyGem failed to install:

Removing /Users/yuanhunglo/.rvm/src/ruby-2.0.0-p0...
Removing /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0...
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Certificates in '/Users/yuanhunglo/.rvm/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0, this may take a while depending on your cpu(s)...
ruby-2.0.0-p0 - #downloading ruby-2.0.0-p0, this may take a while depending on your connection...
ruby-2.0.0-p0 - #extracting ruby-2.0.0-p0 to /Users/yuanhunglo/.rvm/src/ruby-2.0.0-p0
ruby-2.0.0-p0 - #extracted to /Users/yuanhunglo/.rvm/src/ruby-2.0.0-p0
ruby-2.0.0-p0 - #configuring..................
ruby-2.0.0-p0 - #compiling.....
ruby-2.0.0-p0 - #installing ...................................................
Retrieving rubygems-2.0.6
Extracting rubygems-2.0.6 ...
Removing old Rubygems files...
Installing rubygems-2.0.6 for ruby-2.0.0-p0................................................
Error running 'env GEM_PATH=/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0:/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0@global:/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0:/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0@global GEM_HOME=/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0 /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/setup.rb',
please read /Users/yuanhunglo/.rvm/log/ruby-2.0.0-p0/1375477539_rubygems.install.log
Installation of rubygems did not complete successfully.
Saving wrappers to '/Users/yuanhunglo/.rvm/wrappers/ruby-2.0.0-p0'...........

ruby-2.0.0-p0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-2.0.0-p0 - #importing default gemsets, this may take time...............................
Install of ruby-2.0.0-p0 - #complete 
Making gemset ruby-2.0.0-p0 pristine................................................................................................................................................................................................................
Error running '__rvm_with ruby-2.0.0-p0 /Users/yuanhunglo/.rvm/scripts/gemsets pristine',
please read /Users/yuanhunglo/.rvm/log/ruby-2.0.0-p0/1375477541_gemset.pristine-ruby-2.0.0-p0.log
Making gemset ruby-2.0.0-p0@global pristine.................................................................................................................................................................................................................
Error running '__rvm_with ruby-2.0.0-p0@global /Users/yuanhunglo/.rvm/scripts/gemsets pristine',
please read /Users/yuanhunglo/.rvm/log/ruby-2.0.0-p0/[email protected]
/Users/yuanhunglo/.rvm/src/ruby-2.0.0-p247 has already been removed.
Removing /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p247...
Searching for binary rubies, this might take some time.
Installing requirements for osx, might require sudo password.
Certificates in '/Users/yuanhunglo/.rvm/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
ruby-2.0.0-p247 - #configure
ruby-2.0.0-p247 - #download
ruby-2.0.0-p247 - #validate archive
ruby-2.0.0-p247 - #extract
ruby-2.0.0-p247 - #validate binary
ruby-2.0.0-p247 - #setup
Saving wrappers to '/Users/yuanhunglo/.rvm/wrappers/ruby-2.0.0-p247'...........
ruby-2.0.0-p247 - #importing default gemsets, this may take time.......................
Making gemset ruby-2.0.0-p247 pristine....
Making gemset ruby-2.0.0-p247@global pristine....
Making gemset ruby-2.0.0-p247@railstutorial_rails_4_0 pristine....

I'm not sure if I need to install or modify something.

Here's the install.log

[2013-08-02 14:05:39] /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
Exception `LoadError' at /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1073 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/ruby
Error loading RubyGems plugin "/Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0@global/gems/rubygems-bundler-1.1.1/lib/rubygems_plugin.rb": cannot load such file -- openssl (LoadError)
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:355: warning: already initialized constant Gem::Security::DIGEST_ALGORITHM
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:355: warning: previous definition of DIGEST_ALGORITHM was here
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:360: warning: already initialized constant Gem::Security::DIGEST_NAME
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:360: warning: previous definition of DIGEST_NAME was here
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:365: warning: already initialized constant Gem::Security::KEY_ALGORITHM
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:365: warning: previous definition of KEY_ALGORITHM was here
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:370: warning: already initialized constant Gem::Security::KEY_LENGTH
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:370: warning: previous definition of KEY_LENGTH was here
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:375: warning: already initialized constant Gem::Security::ONE_YEAR
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:375: warning: previous definition of ONE_YEAR was here
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:385: warning: already initialized constant Gem::Security::EXTENSIONS
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:385: warning: previous definition of EXTENSIONS was here
/Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require': cannot load such file -- openssl (LoadError)
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policy.rb:23:in `initialize'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policies.rb:6:in `new'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policies.rb:6:in `<module:Security>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security/policies.rb:1:in `<top (required)>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/security.rb:583:in `<top (required)>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/package.rb:43:in `<top (required)>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/installer.rb:8:in `<top (required)>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/request_set.rb:5:in `<top (required)>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems.rb:200:in `finish_resolve'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/rdoc.rb:14:in `<top (required)>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/uninstaller.rb:10:in `<top (required)>'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/core_ext/kernel_require.rb:51:in `require'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/commands/setup_command.rb:474:in `uninstall_old_gemcutter'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/commands/setup_command.rb:146:in `execute'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/command.rb:305:in `invoke_with_build_args'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/command_manager.rb:170:in `process_args'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/command_manager.rb:130:in `run'
    from /Users/yuanhunglo/.rvm/src/rubygems-2.0.6/lib/rubygems/gem_runner.rb:60:in `run'
    from setup.rb:45:in `<main>'
RubyGems 2.0.6 installed

Much thanks in advance.

Upvotes: 1

Views: 2453

Answers (1)

d_rail
d_rail

Reputation: 4119

See this answer: RVM ruby on rails issue OpenSSL .

Uninstall rvm, install openssl, install rvm


Instructions from: http://www.dinduks.com/rails-cannot-load-such-file-openssl/ :

This error means that your Ruby isn’t compiled with openssl.

Assuming that you use RVM, these are the steps to follow to fix this issue.

Install the openssl package

rvm pkg install openssl

Remove the Ruby installation you’re using

rvm remove 1.9.3

And finally recompile Ruby with openssl

rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr

Everything should be working now. Don’t forget to:

rvm use 1.9.3 --default


Side note: I recommend installing rbenv instead of rvm.

Upvotes: 2

Related Questions