249
votes

I was doing attempting to do some updates to openssl using homebrew and I somehow managed to break everything. I can't do anything now, this is what I get when I try to do bundle install:

$ bundle install
/Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in    `require': dlopen(/Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method (LoadError)
Referenced from: /Users/asServer/.rbenv/versions/2.1.2/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/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/openssl.rb:17:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/security.rb:11:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/package.rb:43:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/dependency_installer.rb:3:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/installer.rb:2:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli/install.rb:78:in `run'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:146:in `install'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `run'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/base.rb:440:in `start'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:9:in `start'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `block in <top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/bin/bundle:23:in `load'
    from /Users/asServer/.rbenv/versions/2.1.2/bin/bundle:23:in `<main>'
10
SSLv2 is broken, so there's almost no reason for code to have SSLv2_client_method. Can you open the Ruby file(s) and comment out references to SSLv2 methods? The underlying cause is libssl in /usr/local/opt/openssl/lib was configured with no-ssl2 (but it should not be a problem in 2014).jww

10 Answers

289
votes

I just fixed a similar issue on my system. You need to rebuild your install of Ruby 2.1.2 and it will re-link against the newly-updated SSL.

$ rbenv install 2.1.2
rbenv: /Users/ryan/.rbenv/versions/2.1.2 already exists
continue with installation? (y/N) y
Downloading ruby-2.1.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/f22a6447811a81f3c808d1c2a5ce3b5f5f0955c68c9a749182feb425589e6635
Installing ruby-2.1.2...
Installed ruby-2.1.2 to /Users/ryan/.rbenv/versions/2.1.2
186
votes

I had a similar issue after upgrading openssl. I use rvm. I started by upgrading rvm.

$ rvm get stable

I next reinstalled 1.9.3.

rvm reinstall ruby-1.9.3-p545

After reinstalling, I ran:

$ rvm gemset pristine

If you see any errors restoring your gemset, your best option will be to empty the gemset and rebuild it.

rvm gemset use mygemset
rvm gemset empty mygemset
gem install bundler
bundle install

If you have multiple gemsets, you will have to repeat these steps for each one of them.

17
votes

Have same issue for 1.9.3-p547, under rvm

rvm reinstall ruby-1.9.3-p547

Ruby gets re-installed, but fails in setting up a gemset_pristine for the application because

libv8 version 3.16.14.3 failed

which was the reason I got to this point in the first place. Vicious frustration circle...

update
Check your platform version. I have for example Darwin 10.8 and that is not listed here. So, unless your version of the libv8 gem has a precompiled binary for your platform, it is going to take a long (long-long) time. Go out for dinner, a movie, chill out... If enough ask, maybe they'll set up a binary distro...

14
votes

Had the same error and solved it by brew upgrade openssl

7
votes

You might be a dork like me, with multiple openssl's

I had the same issue for 2.1.2 and Ryan Dlugosz's excellent answer didn't go far enough. My problem was that I had multiple versions of openssl installed (I think I'd installed through brew and git in previous projects).

I had to delete /opt/local/bin/openssl and then rebuild 2.1.2.

Check global rbenv ruby

$ rbenv global
2.1.2

Check openssl

$ which -a openssl
/opt/local/bin/openssl
/opt/local/bin/openssl
/usr/bin/openssl

Kill off duplicate openssl

$ sudo rm -rf /opt/local/bin/openssl

Rebuild 2.1.2

$ rbenv install -f 2.1.2
Downloading openssl-1.0.1g.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/53cb818c3b90e507a8348f4f5eaedb05d8bfe5358aabb508b7263cc670c3e028
Installing openssl-1.0.1g...
Installed openssl-1.0.1g to /Users/globber/.rbenv/versions/2.1.2

Downloading ruby-2.1.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/f22a6447811a81f3c808d1c2a5ce3b5f5f0955c68c9a749182feb425589e6635
Installing ruby-2.1.2...
Installed ruby-2.1.2 to /Users/globber/.rbenv/versions/2.1.2
5
votes

When did not solve problem at all, I suggest deleting RVM. And reinstall RVM and Rails.

deleting RVM

How can I remove RVM (Ruby Version Manager) from my system?

installing RVM, Rail

$ curl -L https://get.rvm.io | bash -s
$ rvm get stable
$ rvm requirements
$ rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/usr
$ rvm use 2.0.0 $ gem update --system 2.0.3
$ gem install rails --version 4.0.5

4
votes

rbenv users:

It helps to make sure that you are using the right version of ruby. If you reinstall rbenv or install a new ruby, change to the ruby version you just installed:

$ rbenv local 2.1.3

1
votes

In case it might help anyone: I had a newer version of Ruby installed (2.1.2), and in my .ruby-version file I referenced the old one (2.0.0-p353)

Changing my .ruby-version file to 2.1.2 fixed the issue for me.

1
votes

I had a similar problem, which occurred after upgrading to ruby 2.2.2. However, my environment is a little different causing the above solutions to not work.

I'm using:

  • OSX Yosemite (10.10.4)
  • chruby
  • ruby-install
  • openssl (installed via homebrew)

The following command(s) resolved this in my situation:

> sudo ruby-install -r /opt/rubies ruby 2.2.2 -- --with-openssl-dir=/usr/local/opt/openssl
> gem install bundler
> bundler install
0
votes

In addition to the acceptance answers above, you may have to tell rbenv to use the newly installed version. For example, I had the old version in ~/.rbenv/version, so rbenv was always using the old one. Manually setting the new version in that file (or through the command line) should fix the problem.

rbenv install -f 2.1.2
rbenv versions
rbenv global 2.1.2 //sets global version to 2.1.2