Error loading command install loaderror 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 fi...

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

asked Feb 28, 2013 at 6:54

Stephen Nguyen's user avatar

Stephen NguyenStephen Nguyen

5,2775 gold badges23 silver badges28 bronze badges

0

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

answered Feb 28, 2013 at 10:42

Valery Kvon's user avatar

9

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.

answered Mar 5, 2013 at 8:58

xyz's user avatar

xyzxyz

2,2572 gold badges25 silver badges41 bronze badges

2

I had very bad time with this ERROR.
Finally i done with it. There is only Once solution either you are with RVM or without RVM.

Make sure you have installed OpenSSL first BEFORE installing ruby.

RVM

  1. Uninstall rvm

    rvm implode

or

rm -rf ~/.rvm

Don’t forget to remove the script calls in your .bashrc and/or .bash_profile (or whatever shell you’re using).
sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev curl git-core python-software-properties libpq-dev nodejs

Then install RVM, post ruby.

OR

rvm pkg install openssl
rvm reinstall ruby-2.0.0-p0 --with-gcc=gcc-4.7 --with-openssl-dir=$rvm_path/usr

WITHOUT RVM

First you should find where Ruby is:

whereis ruby

will list all the places where it exists on your system, then you can remove all them explicitly. Or you can use something like this:

rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem

THEN

sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev curl git-core python-software-properties libpq-dev nodejs

apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
make install

I hope this help you.

answered Dec 7, 2013 at 18:12

Pravin Mishra's user avatar

Pravin MishraPravin Mishra

8,2104 gold badges36 silver badges49 bronze badges

I fix this error for ruby 2.1.2 as follow.

rvm pkg install openssl
rvm reinstall ruby-2.1.2 --with-openssl-dir=$rvm_path/usr

answered Mar 26, 2020 at 18:44

Danish Ali's user avatar

Danish AliDanish Ali

1341 silver badge8 bronze badges

1

On OSX, with rbenv and homebrew, the following worked for me:

brew install openssl
CONFIGURE_OPTS=--with-openssl-dir=$(brew --prefix openssl) rbenv install whatever-ruby-version

answered Jan 6, 2016 at 21:26

hjing's user avatar

hjinghjing

4,8821 gold badge25 silver badges29 bronze badges

This worked for me which is similar to some of the other answers already posted.

rvm pkg install openssl
rvm reinstall all --force

answered Mar 17, 2013 at 1:35

Flynn's user avatar

FlynnFlynn

611 bronze badge

When installing ruby 2.0, it is possible that rubygems 2.0 installation did not complete ok, because of openssl.
Make sure you provide a valid path to the openssl config file; you could:

find . -type f -name "openssl.cnf"

path is usually $HOME/.rvm/usr or $HOME/.rvm/usr/ssl

Then

[sudo] rvm reinstall ruby-2.0.0-p0 --with-openssl-dir=[openssl.cnf path] --verify-downloads 1

Make sure rubygems installation complete successfully.
Might be a better way to fix that path without reinstalling, but this should do it.

answered Mar 1, 2013 at 18:40

fdibartolo's user avatar

Make sure to check out this page on the rvm site: https://rvm.io/packages/openssl/

Running

rvm requirements run

gave me:

Missing required packages: autoconf, automake, libtool, pkg-config, apple-gcc42, readline, libxml2, libxslt, libksba, openssl, sqlite

after brew install autoconf automake ...

I was able to rvm reinstall 2.0.0 without openssl errors

answered Mar 2, 2013 at 14:12

Josan's user avatar

JosanJosan

1451 silver badge6 bronze badges

I had the same problem with the same OS version. I use rvm and followed the steps in this command:

$ rvm requirements

Following those instructions, I ran:

$ brew update
$ brew tap homebrew/dupes
$ brew install bash curl git
$ brew install autoconf automake apple-gcc42 libtool pkg-config openssl readline libyaml sqlite libxml2 libxslt libksba

answered Mar 6, 2013 at 22:32

Robert Mackenzie's user avatar

I had the same problem earlier, tried all of the snippets about and none of them worked out. After looking around for a bit the following worked for me:

$ rvm remove 2.0.0 # get rid of unsuccessful installation
$ rvm get head --autolibs=3 # get the latest RVM and build required libs
$ rvm requirements # just in case, install all other required stuff
$ rvm install ruby-2.0.0
$ rvm --default use ruby-2.0.0

What does rvm get head --autolibs=3 do exactly? I’m guess it automatically downloads dependencies, but I was hoping for a clear answer.

answered Sep 7, 2013 at 19:37

Nikola's user avatar

NikolaNikola

81913 silver badges19 bronze badges

I encountered the same openssl error on Fedora when trying to use gem install <package>. It seems you need to install additional packages with yum/dnf

sudo dnf install rubygems rubygem-bundler ruby-devel mariadb-devel

After running the above command, gem install <package> should now work.

answered Jan 14, 2016 at 1:14

Adam Prax's user avatar

Adam PraxAdam Prax

6,3533 gold badges30 silver badges31 bronze badges

just went through the same problem. Takes a bit time but, upgrading openssl with

brew upgrade openssl@1.1

worked for me. Version might be different in the future, type brew install openssl to see which version you can upgrade to. I hope it helps.

answered Jun 12, 2020 at 9:09

2rule's user avatar

2rule2rule

91 bronze badge

If you have libssl1.1, your problem may be that these older versions of ruby (2.4 is the cutoff) are only compatible with libssl1.0.

For debian/ubuntu, please ensure that apt-get install libssl1.0-dev succeeds.

answered Dec 21, 2020 at 2:16

JellicleCat's user avatar

JellicleCatJellicleCat

27.6k23 gold badges106 silver badges160 bronze badges

If you are using ruby-install, it will take the same openssl argument as rvm:

ruby-install ruby-2.0.0-p247 -- --with-openssl-dir=/usr/local/opt/openssl

answered Feb 20, 2020 at 17:36

alexcoll's user avatar

Description

Hello, I’ve spent the last day and a half troubleshooting an issue with rvm, Homebrew, ruby 2.3.x, and OpenSSL 1.1. This issue seems to manifest with both latest as acquired via rvm get head, rvm get master, and via the rvm.io website as of time of writing for this issue.

Essentially, it appears that rvm allows rubies to build with and link against OpenSSL 1.1 as installed to /usr/local/opt/openssl, but then built rubies seem to expect libssl.1.0.0.dylib when require 'openssl' is called. With bundler this error manifests as:

Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
RVM are available at rvm.io/packages/openssl.

which began occurring after OpenSSL 1.1 was installed (and 1.0 was removed) by Homebrew. Launching irb with irb -d -ropenssl also exposes the issue as it will throw a LoadError exception and quit. Reinstalling rubies does not fix the issue, and if I set autolibs to abort via rvm autolibs fail and then rebuild, autolibs will not fail-abort and the build will continue unimpeded, but incorrectly linked.

The workaround outlined at https://wiki.archlinux.org/index.php/RVM#RVM_uses_wrong_OpenSSL_version seems to fix the issue and allows correct builds, but requires the --with-openssl-dir switch to be set each time one wants to install a new ruby. (I tried installing this to my .bash_profile via an export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOME/.rvm/usr" line but I don’t think this is the right env var)

Steps to reproduce

I have to improvise a bit here because I spent a day and a half troubleshooting and diagnosing this issue before I was able to find a fix.

  1. Install OpenSSL via homebrew (it should install 1.1 to /usr/local/Cellar/openssl@1.1, and symlink that path to /usr/local/opt/openssl): brew install openssl; ls -lt /usr/local/opt/ | grep openssl
  2. Verify that /usr/local/opt/openssl/libssl.dylib links to libssl1.1.dylib: ls -lt /usr/local/opt/openssl/lib | grep libssl
  3. Install ruby via rvm: rvm install 2.3.7 (or whatever version). Note that in the described bug state, there will be numerous errors installing gems appearing in the build’s console output:
ruby-2.3.5 - #importing gemset /Users/tomcorelis/.rvm/gemsets/global.gems..................there was an error installing gem gem-wrappers
.................there was an error installing gem rubygems-bundler
.........................there was an error installing gem rvm

and so on.
4. Verify install with ruby -v then try irb -ropenssl. irb should immediately throw LoadError: cannot load such file -- openssl
5. Similarly, gem install bundler will fail, also throwing LoadError.

Workaround:
6. Install openssl via rvm pkg install openssl
7. Remove and reinstall rubies with rvm reinstall 2.3.1 --with-openssl-dir=$HOME/.rvm/usr
8. Repeat steps 4 and 5 and they should no longer throw exceptions; ruby should function as normal

Expected behavior

I expected rvm to handle OpenSSL 1.1 either by throwing an error or having compilation link to the correct dylibs. Compiled rubies should not throw LoadError when requiring openssl.

Actual behavior

Here is the output of a typical install that fails: https://gist.github.com/lyjia/10fda651f035a22ff7df1d884d9d9ccf

Additionally, by forcing ruby to link against Homebrew-installed /usr/local/opt/openssl@1.0 I was able to induce an interesting error:
https://gist.github.com/lyjia/9efbaa0caf5f1265121e91fb28e96d52

Environment info

ruby-2.3.5:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  system:
    uname:        "Darwin [computer name] 17.7.0 Darwin Kernel Version 17.7.0: Fri Oct  4 23:08:59 PDT 2019; root:xnu-4570.71.57~1/RELEASE_X86_64 x86_64"
    name:         "OSX"
    version:      "10.13"
    architecture: "x86_64"
    bash:         "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)"
    zsh:          "/bin/zsh => zsh 5.3 (x86_64-apple-darwin17.0)"
    remote_path:  "osx/10.13/x86_64"
    xcode:        ""

  rvm:
    version:      "1.29.9-next (master)"
    updated:      "1 hour 17 minutes 33 seconds ago"
    path:         "/Users/tomcorelis/.rvm"
    autolibs:     "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."

  ruby:
    interpreter:  "ruby"
    version:      "2.3.5p376"
    date:         "2017-09-14"
    platform:     "x86_64-darwin17"
    patchlevel:   "2017-09-14 revision 59905"
    full_version: "ruby 2.3.5p376 (2017-09-14 revision 59905) [x86_64-darwin17]"

  homes:
    gem:          "/Users/tomcorelis/.rvm/gems/ruby-2.3.5"
    ruby:         "/Users/tomcorelis/.rvm/rubies/ruby-2.3.5"

  binaries:
    ruby:         "/Users/tomcorelis/.rvm/rubies/ruby-2.3.5/bin/ruby"
    irb:          "/Users/tomcorelis/.rvm/rubies/ruby-2.3.5/bin/irb"
    gem:          "/Users/tomcorelis/.rvm/rubies/ruby-2.3.5/bin/gem"
    rake:         "/Users/tomcorelis/.rvm/rubies/ruby-2.3.5/bin/rake"

  environment:
    PATH:         "/Users/tomcorelis/.rvm/gems/ruby-2.3.5/bin:/Users/tomcorelis/.rvm/gems/ruby-2.3.5@global/bin:/Users/tomcorelis/.rvm/rubies/ruby-2.3.5/bin:/Users/tomcorelis/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/Users/tomcorelis/Library/Python/2.7/bin:/Users/tomcorelis/Library/Python/2.7/bin"
    GEM_HOME:     "/Users/tomcorelis/.rvm/gems/ruby-2.3.5"
    GEM_PATH:     "/Users/tomcorelis/.rvm/gems/ruby-2.3.5:/Users/tomcorelis/.rvm/gems/ruby-2.3.5@global"
    MY_RUBY_HOME: "/Users/tomcorelis/.rvm/rubies/ruby-2.3.5"
    IRBRC:        "/Users/tomcorelis/.rvm/rubies/ruby-2.3.5/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

Related links that helped with finding a workaround

https://wiki.archlinux.org/index.php/RVM#RVM_uses_wrong_OpenSSL_version

https://stackoverflow.com/questions/15511943/troubles-with-rvm-and-openssl

rbenv/ruby-build#1353

Versions tested with

2.3.1, 2.3.5, 2.3.7

Does not seem to manifest with 2.4.9, 2.5.7, or 2.6.5

I have a fresh Ubuntu 12.04 VM, and I would like to install Ruby 2.0.0-p0. I am able to get Ruby installed easily enough, but I am unable to get gems to work.

$ gem install bundler
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 have open SSL installed, so I’m not exactly sure what the problem is.

$ sudo apt-get install libssl1.0.0 libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libssl-dev is already the newest version.
libssl1.0.0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Similarly,

$ which openssl
/usr/bin/openssl

If I go back to the installation, there are two lines that concern me.

$ sudo make install
Failed to configure openssl. It will not be installed.
Failed to configure readline. It will not be installed.

Thanks!

asked Feb 27, 2013 at 12:49

Jarrett Meyer's user avatar

In your source location, cd ext/openssl and then ruby extconf.rb. This will generate a makefile in the ext/openssl directory. Simply make && sudo make install it to build the ruby openssl extension, and install the .so into the appropriate location.

Ditto ext/readline for readline support.

Then you should be able to make ruby properly.

Edit: in case I wasn’t clear enough:

pushd ext/openssl
ruby extconf.rb
make && sudo make install
popd

pushd ext/readline
ruby extconf.rb
make && sudo make install
popd

make
sudo make install

answered Mar 9, 2013 at 12:44

Matty K's user avatar

Matty KMatty K

2012 silver badges5 bronze badges

3

I ran into the same issue, I had to install the following two packages

libssl-dev
libreadline-dev 

in fact I found I had to install the following packages to get ruby 2.0.0 and postgres 9.2 to compile on ubuntu 13.04 with openssl and readline so I thought I would share them

sudo apt-get -y update
sudo apt-get install -y make g++
sudo apt-get install -y curl git-core python-software-properties
sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev
sudo apt-get install -y libgdbm-dev libreadline6-dev libncurses5-dev
sudo apt-get install -y libpq-dev libffi-dev

answered Jul 18, 2013 at 14:46

Chris D's user avatar

Chris DChris D

711 silver badge2 bronze badges

When installing ruby 2.0, it is possible that rubygems 2.0 installation did not complete ok, because of openssl. Make sure you provide a valid path to the openssl config file; you could:

find . -type f -name "openssl.cnf"

path is usually $HOME/.rvm/usr or $HOME/.rvm/usr/ssl

Then

[sudo] rvm reinstall ruby-2.0.0-p0 --with-openssl-dir=[openssl.cnf path] --verify-downloads 1

Make sure rubygems installation complete successfully. Might be a better way to fix that path without reinstalling, but this should do it.

answered Mar 1, 2013 at 20:14

fdibartolo's user avatar

1

I can’t install ruby from source, on configuration (./configure) it states

Ignore OpenSSL broken by Apple.
Please use another openssl. (e.g. using `configure --with-openssl-dir=/path/to/openssl')
Failed to configure openssl. It will not be installed.

Even if I use the told parameter. —with-opt-dir=/usr/local doesn’t help either. Notice, I installed the latest openssl (1.0.1e) from source too (it’s located at /usr/local/ssh).

So later I can’t use gem install, it just states:

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

How can I tell the ruby installation to take my installed openssl?

asked Feb 27, 2013 at 22:12

Appleshell's user avatar

1

Had a similar issue on Tiger (yes, I’m using Ruby 2.0 on a Power Mac G4) – Ruby builds there just fine, but gem install rails fails with «RuntimeError: Unsupported digest algorithm (SHA512).».

Assuming you meant /usr/local/ssl and not /usr/local/ssh for the directory containing OpenSSL 1.0.1e, you should run ./configure as such:

./configure --prefix=/opt/ruby20 --with-openssl-dir=/usr/local/ssl

The configure script will say that —with-openssl-dir is an invalid option. It’s lying. Add /opt/ruby20/bin (or whatever you set as your prefix) to your PATH and enjoy Ruby 2.0 :)

answered Mar 1, 2013 at 6:08

A. Wilcox's user avatar

A. WilcoxA. Wilcox

1881 gold badge1 silver badge6 bronze badges

2

Rather than doing all the building from sources (and having to hunt down any necessary patches) why not try using rvm to build (and manage) your rubies, and homebrew to allow you to build and install the necessary dependencies.

I have used these to get a ruby 2.0.0 build completed earlier today, although I haven’t had a chance to check if it’s fully functional yet.

mmmmmm's user avatar

mmmmmm

28.5k17 gold badges84 silver badges140 bronze badges

answered Feb 27, 2013 at 23:30

Kevin's user avatar

KevinKevin

4,1022 gold badges21 silver badges24 bronze badges

2

You need to change the code page of the current terminal window running this code:

chcp 1252

answered Aug 17, 2017 at 11:31

qusai safa's user avatar

1

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

У меня было очень плохое время с этой ОШИБКОЙ. Наконец я закончил с этим. Существует только одно решение, либо вы с RVM, либо без RVM.

Убедитесь, что вы установили OpenSSL ДО установки ruby.

РВМ

  1. Удалить РВМ

    rvm взорваться

or

rm -rf ~/.rvm

Не забудьте удалить вызовы сценариев в вашем .bashrc и/или .bash_profile (или в любой другой оболочке, которую вы используете). sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev curl git-core python-software-properties libpq-dev nodejs

Затем установите RVM, опубликуйте ruby.

OR

rvm pkg install openssl
rvm reinstall ruby-2.0.0-p0 --with-gcc=gcc-4.7 --with-openssl-dir=$rvm_path/usr

БЕЗ РВМ

Сначала вы должны найти, где находится Ruby:

whereis ruby

перечислит все места, где он существует в вашей системе, после чего вы можете удалить их все явно. Или вы можете использовать что-то вроде этого:

rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem

ТОГДА

sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev curl git-core python-software-properties libpq-dev nodejs

apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
make install

Надеюсь, это вам поможет.

If you like me, installed Ruby by compiling from source code manually, and found that this 2 errors when trying to install bundler

  • cannot load such file — openssl
  • cannot load such file — zlib

You missed configure make to compile with those 2 libraries. Follow these steps to fix this issue.

  1. Remove the installed Ruby with make clean
  2. Install libssl-dev with your OS’s package manager of choice. E.g. apt-get install libssl-dev
  3. Install zlib1g-dev with your OS’s package manager of choice. E.g. apt-get install zlib1g-dev
  4. Config make file to include openssl by go to ext/openssl and run ruby extconf.rb
  5. Config make file to include zlib by go to ext/zlib and run ruby extconf.rb
  6. Go back to ruby source code directory run make && make install
  7. You should be able to successfully run gem install bundler

You can also do the same thing for readline. Install libreadline-dev and run extconf.rb in ext/readline

Tested with ruby 2.0.0p247

Credit:

  • http://askubuntu.com/questions/261914/install-ruby-2-0-with-openssl-and-readline-support
  • http://stackoverflow.com/questions/769496/ubuntu-noob-rails-install-fails-on-zlib

Понравилась статья? Поделить с друзьями:
  • Error loading colour scheme sublime text
  • Error load font аризона рп
  • Error loading cod4x как исправить
  • Error load file cryptlib dll
  • Error loading cod4x call of duty