Rails 3 - No Such File to Load -- Openssl

no such file to load -- openssl

Are you using RVM?

If so you may want to reinstall ruby with the location of your openssl installation passed as an option:

$ rvm remove 1.8.7
$ rvm install 1.8.7 --with-openssl-dir=/usr/local/openssl # or wherever openssl is installed

On a Debian-based system, you can find where openssl is installed by running the following command:

$ dpkg -L openssl

Alternatively you can have RVM install openssl for you:

$ rvm package install openssl
$ rvm remove 1.8.7
$ rvm install 1.8.7 --with-openssl-dir=$HOME/.rvm/usr

Note that afterwards you'll need to re-install rails:

$ gem install rails

cannot load such file -- openssl (LoadError)

Check what rubies are installed:

rvm list

Then make sure to use one of the installed rubies:

rvm use 1.9.3-p327

And test if openssl is available:

ruby -ropenssl -e "puts :OK"

It will print OK if openssl is enabled, otherwise you will get exception

In case of exception =>

UPDATE:

new version of rvm has improved automation support:

rvm get stable
rvm autolibs enable
rvm reinstall all --force

OLD:

run:

rvm requirements run force
rvm pkg remove

Followed by:

rvm reinstall all --force

This instruction is not OSX specific, it will work on all platforms, although on OSX it will work best with HomeBrew, when it's not installed only list of required software will be shown and you need to install it manually.

Error while creating new Rails 3 project : `require': cannot load such file -- openssl (LoadError)

You need to bundle your ruby with openssl support. Have a look at http://beginrescueend.com/packages/openssl/

rvm reinstall 1.9.3 --with-openssl-dir=/usr/local

This requires that you have the openssl headers present on your box. These are named differently across the systems, like libopenssl-dev, libssl-dev, openssl-devel etc..

How to resolve Cannot load such file openssl error?

Uninstall ruby and opensssl and then run this:

rvm reinstall 2.2.9 --with-openssl-dir=$HOME/.rvm/usr

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

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


Related Topics



Leave a reply



Submit