249

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>'
jww
  • 97,681
  • 90
  • 411
  • 885
Lenek
  • 2,517
  • 2
  • 12
  • 9
  • 2
    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 Aug 25 '14 at 19:43

10 Answers10

289

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
Ryan Dlugosz
  • 3,206
  • 1
  • 16
  • 12
  • This is happening after a fresh install of ruby 1.9.3 via rvm. New Mac and an old code base. Do I need a different version of openssl? – digidigo Aug 28 '14 at 20:33
  • 8
    @twelve17 The errors are related to not being able to find an SSL library and the OP mentioned that they had recently upgraded their installed version of openssl. I had the same issue with the same upgrade scenario; I suspect the reinstall fixes things by causing Ruby to be built against the upgraded libraries (the old ones cannot be found). – Ryan Dlugosz Sep 08 '14 at 23:16
  • 8
    Just to add to this, if a boxen user comes across this - I could not get rbenv to reinstall using the commands above - so I had to uninstall and reinstall 2.1.2 using rbenv `rbenv uninstall 2.1.2` `rbenv install 2.1.2` `bundle` – jeffsaracco Sep 10 '14 at 13:18
  • Thank you @RyanDlugosz. I'm a dummy, missed the openssl reference in the OP, and then assumed you meant your own updated openSSL. Apologies! – twelve17 Sep 17 '14 at 22:09
  • I can't say for sure but I believe this problem arose after I installed postgresql and the pg gem. I also naively set my ARCHFLAGS env variable as per homebrew's instructions. Again, not sure what if any of that led to this issue but if you did any of those things, this answer may work for you as well. – wuliwong Oct 03 '14 at 02:36
  • 4
    After yosemite upgrade, I had this issue. The above worked, but only after I redirected my gcc. ````export CC=/usr/bin/gcc```` For more info: [here is the github issue from rbenv that helped](https://github.com/sstephenson/rbenv/issues/610) – Dan Williams Oct 20 '14 at 22:10
  • Some may need to run `rbenv rehash` after installing a new ruby [the github](https://github.com/sstephenson/rbenv#rbenv-rehash) – The Brofessor Oct 28 '14 at 01:24
  • After Yosemite, you need to use `clang` or `/usr/bin/gcc` instead of `gcc-4.2` before install ruby. I blogged [how I did](http://goo.gl/bJfqYu) exactly. – zdk Nov 03 '14 at 10:59
  • This happened to me after updating all my homebrew formulas. The above reinstall fixed the problem without having to run `rbenv rehash`. – sumizome Nov 04 '14 at 01:28
  • 1
    If you installed rbenv with homebrew you may need to `brew upgrade rbenv ruby-build` as well. – Justin Tanner Nov 23 '14 at 04:26
186

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.

Sandeep M
  • 2,942
  • 2
  • 13
  • 17
  • 10
    This worked for me. rvm kicked off the building of gemset pristine automatically. – Ducain Oct 03 '14 at 16:16
  • Worked for me on Yosemite, I just ran: `rvm get stable` and `rvm reinstall ruby-2.0.0` – MatCarey Oct 22 '14 at 09:14
  • 4
    On Yosomite I had a problem installing ruby, since it's not able to find right `gcc` version. I ended up with `CC=/usr/bin/gcc rvm reinstall ruby-1.9.3-p551` – Alexander Beletsky Dec 03 '14 at 09:51
  • @MatCarey `rvm get stable` and `rvm reinstall ruby-2.0.0` worked in Mavericks too. Thanks. – amertkara Dec 16 '14 at 16:15
  • What worked for me is `rvm get stable` followed by `rvm install ruby-2.0.0-p598` (since I was behind a few patch versions). Also, I updated `.ruby-version`, ran `bundle`, and exited my current working directory (`cd ..`) and returned to it (`cd -`) before successfully running `foreman start`. – user664833 Jan 08 '15 at 22:03
  • Reiterating @Ducain's comment the gemset pristine automatically runs as part of the re-install; you don't have to run it again manually. – Teflon Ted Aug 17 '15 at 13:29
17

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

Jerome
  • 5,583
  • 3
  • 33
  • 76
  • 1
    I also need support for ruby 1.9.3 and am using `rvm`, `homebrew` and `xcode` v6.1.1 on Yosemite 10.10.2. I used just `rvm reinstall ruby-1.9.3-p394`; after compiling the new ruby, RVM made the gems pristine, as well with no issues. – Tom Harrison Mar 01 '15 at 04:07
  • Yes, it is based on the binary distribution. The link is there to allow one to check first if they will get an immediate response or go off and meditate! – Jerome Apr 29 '15 at 08:01
14

Had the same error and solved it by brew upgrade openssl

DaveWoodall.com
  • 727
  • 6
  • 22
7

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
Ralph Cowling
  • 2,839
  • 1
  • 20
  • 10
5

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

Community
  • 1
  • 1
Hajime
  • 139
  • 4
4

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

Community
  • 1
  • 1
dechimp
  • 99
  • 1
  • 3
1

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.

lafeber
  • 2,683
  • 1
  • 27
  • 29
1

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
Catharz
  • 1,105
  • 10
  • 18
0

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
adairdavid
  • 413
  • 1
  • 7
  • 17
  • and if you have troubles with rbenv not seeing later versions, like somebody I know did... be sure you've updated ruby-build. most likely through brew. – wkhatch Aug 09 '15 at 00:40