Sunday, April 1, 2012

Segmentation Fault when you run ruby / rake / rails / gem install commands

this post is based on
http://www.christopherirish.com/2011/09/02/ruby-1-9-2-segmentation-fault-and-openssl/


every ruby developer must have seen "Segmentation fault" when they run rake tasks, install gems or updating gems. The usual reason is because of the depending libraries are not updated or using the wrong one during the setup of ruby runtime.


very often it is because of openssl or iconv. To fix that error, you have to re-install your ruby runtime. If you are using rvm, these are the commands to uninstall and reinstall everything with correct libraries:


rvm remove 1.9.3
rvm pkg install iconv
rvm pkg install openssl
rvm install ruby-1.9.3 --with-openssl-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr