Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)

Ruby on-RailsOpensslHomebrewRbenv

Ruby on-Rails Problem Overview


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>'

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

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

Solution 2 - Ruby on-Rails

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.

Solution 3 - Ruby on-Rails

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...

Solution 4 - Ruby on-Rails

Had the same error and solved it by brew upgrade openssl

Solution 5 - Ruby on-Rails

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

Solution 6 - Ruby on-Rails

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

deleting RVM >https://stackoverflow.com/questions/3558656/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

Solution 7 - Ruby on-Rails

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

Solution 8 - Ruby on-Rails

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.

Solution 9 - Ruby on-Rails

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

Solution 10 - Ruby on-Rails

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLenekView Question on Stackoverflow
Solution 1 - Ruby on-RailsRyan DlugoszView Answer on Stackoverflow
Solution 2 - Ruby on-RailsSandeep MView Answer on Stackoverflow
Solution 3 - Ruby on-RailsJeromeView Answer on Stackoverflow
Solution 4 - Ruby on-RailsDaveWoodall.comView Answer on Stackoverflow
Solution 5 - Ruby on-RailsRalph CowlingView Answer on Stackoverflow
Solution 6 - Ruby on-RailsHajimeView Answer on Stackoverflow
Solution 7 - Ruby on-RailsdechimpView Answer on Stackoverflow
Solution 8 - Ruby on-RailslafeberView Answer on Stackoverflow
Solution 9 - Ruby on-RailsCatharzView Answer on Stackoverflow
Solution 10 - Ruby on-RailsadairdavidView Answer on Stackoverflow