Ruby and “You must recompile Ruby with OpenSSL support or change the sources in your Gemfile”

前端 未结 12 1731
庸人自扰
庸人自扰 2020-12-07 20:31

Using rvm I upgraded my ruby to 1.9.3-p392, also added 2.0.0, anytime I try to use this version when I run my bundle command I get this error.

Could not load         


        
相关标签:
12条回答
  • 2020-12-07 21:08

    In my case after:

     1. brew install openssl
     2. rvm install ruby-2.6.0
    

    bundle install failed with this error. The problem was that openssl was globally set so I had to install the new ruby version by setting the openssl directory explicitly.

    So what I had to do was:

     1. rvm reinstall ruby-2.6.0 --with-openssl-dir=/usr/local/opt/openssl
     2. rvm reload
    

    Assuming that usr/local/opt/openssl is where it is installed.

    After that bundle install ran successfully.

    Warning when I tried this command with this path /usr/local like some answers suggested, it didn't work.

    0 讨论(0)
  • 2020-12-07 21:09

    The new way to do it, according to a comment by @Purplejacket above, is the following:

    rvm autolibs homebrew
    rvm install 2.1.1
    rvm use 2.1.1
    

    It's much easier.

    0 讨论(0)
  • 2020-12-07 21:09

    This helps me install 1.9.3-head on Mac:

    rvm get latest    
    brew install openssl    
    rvm reinstall 1.9.3-head --with-openssl-dir=`brew --prefix openssl`
    
    0 讨论(0)
  • 2020-12-07 21:14

    To get this working again I had to install homebrew and move my mac ports out of the way. Then do the following after removing 1.9.3-p392 and 2.0.0-p0:

    rvm get head --autolibs=3
    rvm install 1.9.3 --with-opt-dir=/usr/bin
    rvm install 2.0.0
    

    There was something not working with my mac ports and openssl and make and configure. This was the only way I was able to get rvm to install ruby again with out getting openssl issues or make/configure issues.

    0 讨论(0)
  • 2020-12-07 21:14

    On macOS 10.14, Ruby 2.5.3, and OpenSSL 1.0.2n this worked for me:

    ./configure --with-openssl --with-openssl-dir=/usr/local/ssl
    

    but I was only trying what the error messages were telling me:

    *** Following extensions are not compiled:
    openssl:
        Could not be configured. It will not be installed.
        /Users/brian/Desktop/Ruby/ruby-2.5.3/ext/openssl/extconf.rb:97: OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed.
        Check ext/openssl/mkmf.log for more details.
    *** Fix the problems, then remove these directories and try again if you want.
    make[1]: *** [note] Error 1
    
    0 讨论(0)
  • 2020-12-07 21:15

    In my case:

    Problem: After installing ruby-2.3.1, I ran the command bundle install and then the error occurred.

    Solution:

    • I first installed OpenSSL on my machine. $ brew install openssl
    • And then, reinstalled the ruby version I require (2.3.1) with the openssl.

      $ rvm reinstall 2.3.1 --with-openssl-dir=/usr/local/opt/openssl

    And this solved my problem!

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