Gem install rails output error in ubuntu

I am new to this environment and I am trying to install rails. I installed ruby ​​and checked with rvm list I got ruby-2.0.0-p0 as current and default. I tried to install rails after installing ruby

 gem install rails 

getting errors:

 ERROR: Loading command :install (LoadError) cannot load such file -- openssl ERROR: while executing gem ... (NoMethodError) undefined method `invoke_with_build_args` for nil:NilClass 
+4
source share
2 answers

You are missing openssl there :)

Install openssl package

 rvm pkg install openssl 

Uninstall the Ruby installation you are using

 rvm remove 2.0.0 

And finally recompile Ruby with openssl

 rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/usr 

Now everything should work. Do not forget:

 rvm use 2.0.0 --default 
+7
source

For the cool kids that compiled from source, I had this problem, although I had OpenSSL installed on my machine with the latest version. It turned out I needed this library again:

 sudo apt-get install libssl-dev 

Then I just recompiled and it worked.

+6
source

All Articles