ruby 2.0 rails gem install error “cannot load such file — openssl”

前端 未结 13 1276
难免孤独
难免孤独 2020-11-28 22:12

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

$         


        
相关标签:
13条回答
  • 2020-11-28 22:51

    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.

    0 讨论(0)
  • 2020-11-28 22:54

    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.

    0 讨论(0)
  • 2020-11-28 22:54

    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.

    0 讨论(0)
  • 2020-11-28 22:57

    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.

    0 讨论(0)
  • 2020-11-28 22:59

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

    rvm pkg install openssl
    rvm reinstall all --force
    
    0 讨论(0)
  • 2020-11-28 23:02

    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

    0 讨论(0)
提交回复
热议问题