How to get OpenSSL in Ruby 1.9.3 working on OSX 10.7 (fixing the Segmentation Fault with Ruby OpenSSL)

Published by Rob on January 20th, 2012 - in Ruby

update – this needs to have a recent version of RVM – it works with rvm 1.10 but not with 1.6 – do an rvm update first.

When using the mighty cobweb web crawler on my OSX 10.7 with Ruby 1.9.3 I was getting a seg fault in net http:

net/http.rb:799: [BUG] Segmentation fault

A bit of googling and isolation in IRB showed that this can be caused when hitting HTTPS urls using net http.

I saw a few different solutions to the problem, primarily talking about Ruby 1.9.2.Surprisingly it took me a while to end up at the RVM documentation about the problem: https://rvm.beginrescueend.com/packages/openssl/. This didn’t quite work out of the box for me, so I used the solution in the following gist.

rvm pkg install openssl
rvm remove 1.9.3
rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr --with-gcc=clang
view raw file1.sh This Gist is brought to you using Simple Gist Embed.

and now I can happily crawl https urls.

Related posts:

  1. Two tricks for getting Backbone.js to play well with Ruby on Rails
  2. The Book of Ruby By Huw Collingbourne
  3. Ruby File Generation
  4. Updating RubyGems in OSX 10.5.7

One Response

  1. Yee-haw! I had a similar problem with Net::LDAP segfaulting after upgrading rails from 3.1.0 to 3.2.1 and ruby from 1.9.2 to 1.9.3. I could not find anyone on the ‘net with the same problem, but I did get as far as determining that it had to be an OpenSSL problem on my OSX Lion. Your steps above solved my problem. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Rob@Rojotek