Segmentation Fault while doing bundle install

I recently encountered this error of segmentation fault while doing bundle install in one of my rails application.

After a bit of googling I found out its an issue with ruby 1.9.3.

Here is the solution:

 

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