Segmentation Fault with Rails 3.2.6 on OSX

I was trying to create a new project with Rails 3.2.x. But every time as it runs bundle install, I get the following error:

1
2
3
4
5
6
/Users/home_dir/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
.
.
.
other crap

I tried gem uninstall and reinstalling Rails to no avail. It turns out that Ruby needs to find openssl but couldn’t find it at its preferred location. MacPorts handled all my 3rd party binary needs. But in this case, I wanted to use RVM to handle those packages for dependency reasons.

1
2
3
rvm pkg install iconv
rvm pkg install openssl
rvm reinstall 1.9.3 --with-openssl-dir=~/.rvm/usr --with-iconv-dir=~/.rvm/usr

And that solved the issue for me.

Update 02/22/2013: The lastest version of rvm 1.18.10 apparently will do all kinds of nice things in the background for you to solve the issue as well.

References: