5

I am not a Ruby expert but wanted to figure out what is going on as I am trying to get compass working in a node app but my Ruby seems broken. Typing:

ruby --version

gets me:

ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]

I have Homebrew installed and have previously had issues with Ruby versions but it seems like it is installed and working. However when I enter a request with gem I get this error:

$ gem -h
Error loading RubyGems plugin "/Users/user_dir/.rvm/gems/ruby-2.1.1@global/gems/executable-hooks-1.3.1/lib/rubygems_plugin.rb": dlopen(/Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
in /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle (LoadError)
Error loading RubyGems plugin "/Users/user_dir/.rvm/gems/ruby-2.1.1@global/gems/gem-wrappers-1.2.4/lib/rubygems_plugin.rb": dlopen(/Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib in /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/user_dir/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle (LoadError)
RubyGems is a sophisticated package manager for Ruby.  This is a
basic help message containing pointers to more information.

Usage:
  gem -h/--help
  gem -v/--version
  gem command [arguments...] [options...]

Examples:
  gem install rake
  gem list --local
  gem build package.gemspec
  gem help install

Further help:
  gem help commands            list all 'gem' commands
  gem help examples            show some examples of usage
  gem help platforms           show information about platforms
  gem help <COMMAND>           show help on COMMAND
                               (e.g. 'gem help install')
  gem server                   present a web page at
                               http://localhost:8808/
                               with info about installed gems
Further information:
  http://guides.rubygems.org

I noticed the reference to openssl but couldn't find any issues online about that.

I have tried installing compass on npm and RVM and Homebrew, so, at the moment, I don't know what versions are being used and where to begin trying to resolve the issue.

If you know what the issue is please let me know, or if you need further info about my system.

I looked at: "Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)" and "Error loading RubyGems plugin ,openssl.bundle (LoadError)".

I didn't add npm or node tags as I am quite sure it is a Ruby issue, but left it in the question as I did try to install compass there as well.

I have tried fixing RVM, Homebrew etc., but it is still broken.

2 Answers 2

16

Are you using brew?

If so, brew update or brew upgrade breaks the Ruby runtime which is what caused a similar error for me.

The following solved the issue for me:

brew rm openssl
brew cleanup openssl
brew install openssl
rvm reinstall ruby
gem install compass
1
  • Thanks @1469, I did put the resolution at the top of my answer (there was an old reference to a non existent version of ruby set to default in ~/.rvm/gems/), The openssl fix didn't work for me because it was referencing the wrong version. I didn't accept it because I don't really get what was going on, but it works ATM so I don't want to mess with it.
    – Totoro
    Commented Jan 7, 2015 at 15:39
7

EDIT:

I finally found out that RVM has a default version, so every time I installed a new version it would revert to the old one (I guess this one had errors which is why I didn't notice the version issue).

If you go to:

~/.rvm/gems/

There will be a list of ruby versions and a default folder at the top. Following this page and entering:

rvm --default use 2.1.5

Fixed my problems (for now...)

ORIGINAL:

I tried a lot of different things but eventually got it to work, I have broken this answer down into the list of things I think may have contributed to the result as there were lots of things that didn't work.

This answer to an SO question I found led me down this path.

I reinstalled ruby but because the version in the answer(1.9.3) was older than 2.1.1p76 I just entered:

rvm get stable

then:

rvm reinstall ruby

this kept me on 2.1.1p76, then:

rvm gemset pristine

upgraded gem to 2.4.3

This bit is strange but I then tried to install compass in NPM and it worked but still would not run, then checking my ruby version again gave me 2.1.5p273 (there were no upgrades in between unless RVM gemset pristine updated ruby...). I then tried the mygemset code from the SO answer but got more errors so I decided to just run

gem install bundler

This seemed to work, so I tried:

gem install compass

Which I had tried many times but this time it worked. It installed ffi-1.9.6.gem and 9 gems which I assume were dependancies.

The NPM package then worked and I currently don't have any errors showing up in ruby.

NOTE: I am not going to accept this answer as I don't really know why it worked, if you follow this be aware I don't know ruby and this was just to get compass working in NPM.

NOTE: Many answers had rbenv as a package manager, I wanted to resolve the situation with what was already on the system so I continued to work with RVM.

3
  • I would like to add that this still has not solved the problem, my system seems to regress, I had the same issue the next day and had to upgrade ruby again.
    – Totoro
    Commented Dec 14, 2014 at 4:21
  • 1
    After making sure we had the proper rvm being used (2.1.1) and set it with --default, the following fixed it for our team: rvm gemset pristine. Thanks! Commented Sep 16, 2015 at 15:29
  • I also did not have to uninstall/reinstall, but just set the default.
    – eebbesen
    Commented Oct 23, 2015 at 13:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.