Why Require Mongo Gives Me Loaderror: No Such File to Load -- Openssl

Why require mongo gives me LoadError: no such file to load -- openssl

You need two things: OpenSSL itself and the ruby bindings for OpenSSL. The first part is as Yossi said:

sudo apt-get install libssl

The second depends on how you install ruby. I'm guessing from the paths in your question that you compiled ruby from source. In which case you first need to make sure you have then openssl headers:

sudo apt-get install libssl-dev

then it should be picked up automatically when you compile ruby. If you do not want to recompile ruby, the you should be able to build the OpenSSL bindings by

  • cd to the folder containing the ruby source
  • cd to ext/openssl
  • ruby extconf.rb
  • make && sudo make install

no such file to load -- debugger rspec

People helped me, turns out i did not install rspec gem file, i got it confused with rails-rspec

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

Update: As of December 2020 and beyond, brew switch does not work, so use the other answer by @angabriel:

brew install rbenv/tap/openssl@1.0
ln -sfn /usr/local/Cellar/openssl@1.0/1.0.2t /usr/local/opt/openssl

Original Answer:
Switch to an older openssl package

brew switch openssl 1.0.2s

Or, depending on your exact system configuration, you may need to switch to a different version. Check the output of ls -al /usr/local/Cellar/openssl for the version number to switch to.

brew switch openssl 1.0.2q
# or
brew switch openssl 1.0.2r
# or
brew switch openssl 1.0.2s
# or
brew switch openssl 1.0.2t
# etc...

Error require: cannot load such file -- mongomapper (LoadError) and no idea where to start

You should be requiring mongo_mapper, not mongomapper.

LoadError when creating ruby gem

1.
#require tries to load an absolute path, and if it fails it loads from $:, to add your current directory run the script like this (bash, otherwise use apropriate method to define environment variables for your shell):

RUBYLIB="." ruby riverbattle.rb

In your base.rb require as follows:

require 'riverbattle/game'

2.
see #UPD section

3.
why wouldn't you? (what's your specific problem with this?)

#UPD

The 2nd issue is because you miss #files in your gem specification, no files are included in your gem file, add something like this:

s.files = Dir['lib/*.rb'] + Dir['lib/riverbattle/*.rb']

#UPD2

Just to summarize here is working setup for your gem.

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

How to install a Rails application when using RVM?

please use the "quick fix" from here https://rvm.io/packages/openssl/

you have to ignore the rest of instructions, they are intended for systems that do not support packages (like osx)



Related Topics



Leave a reply



Submit