Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby 2.0 rails gem install error "cannot load such file -- openssl"

I am using osx 10.8.2 installed ruby 2.0 and.... got this when trying to run "sudo gem install rails"

$ sudo gem install rails ERROR:  Loading command: install (LoadError)     cannot load such file -- openssl ERROR:  While executing gem ... (NoMethodError)     undefined method `invoke_with_build_args' for nil:NilClass 

I had ruby 1.9.x and rails 3.2.x working alright before

like image 576
Stephen Nguyen Avatar asked Feb 28 '13 06:02

Stephen Nguyen


2 Answers

You have to install OpenSSL first and recompile ruby again:

RVM:

rvm pkg install openssl rvm reinstall ruby-2.0.0-p0 --with-gcc=gcc-4.7 --with-openssl-dir=$rvm_path/usr 
like image 161
Valery Kvon Avatar answered Oct 07 '22 04:10

Valery Kvon


If you're using RVM please follow:

$ brew install automake $ rvm pkg install openssl $ rvm requirements run $ rvm reinstall all --force $ gem install rails 

It worked for me.

like image 39
xyz Avatar answered Oct 07 '22 04:10

xyz