SSL/OpenSSL issue with Ruby 1.9.3

After upgrading to Ruby 1.9.3x, I was totally unable to use SSL. Even i could not run ‘bundle install’ when i was using ‘https://rubygems.org’ as the source. It was showing a multi-page error messages starting with something like ‘segmentation fault’. For the time being, i’ve used ‘http’ rather than ‘https’ for the rubygems.org url. However, it did not solve other problems.

While googling about it, i found many suggestions and i’ve screwed my OS (Mac OSx) OpenSSL. However, i’ve found a simple solution. It was just two lines of command if you are, like me, using RVM to managing Rubies.

First of all, you need to install openssl package using rvm. So run

$ rvm pkg install openssl

It will install openssl in your rvm path usually .rvm/usr under your home (~) directory.

Now, you need to reinstall your current ruby version (you can also install a newer version if you want) mentioning the path of the OpenSSL.

$ rvm reinstall 1.9.3 --with-openssl-dir=$rvm_path/usr

If you want to install a new version, you should use ‘install’ rather than ‘reinstall’.

That should solve your problem. If not, my sympathy goes for you. Good luck googling!