gem install fails with openssl failure

后端 未结 11 1053
花落未央
花落未央 2020-12-07 07:51

I tried to install cocoapods (http://cocoapods.org/) on my OSX Mountain Lion.

 moshe-mbp:~ moshem$ gem install cocoapods
 ERROR:  Could not find a valid gem          


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

    I had the same error. To fix just run the following commands (I know you've ran some but humor me):

    brew update
    brew install openssl
    brew link openssl --force
    brew install curl-ca-bundle
    

    After that, open a new shell or source your files and all should be good to go :)

    UPDATE:

    To update your paths you'll need to edit your /etc/paths file so do something like:

    sudo vim /etc/paths
    

    In there is should look something like:

    /usr/bin
    /bin
    /usr/sbin
    /sbin
    /usr/local/bin
    

    What you want to do is to ensure that /usr/local/bin is at the top of the file. So change it to something like:

    /usr/local/bin
    /usr/bin
    /bin
    /usr/sbin
    /sbin
    

    Hope that fixes it!

    0 讨论(0)
  • 2020-12-07 08:40

    The following got everything working for me!

    rvm get stable
    
    brew update
    
    brew install libyaml
    brew install pkg-config 
    brew install libxml2 
    brew install libxslt
    
    brew install openssl
    brew link openssl --force
    
    brew install sqlite
    
    brew install apple-gcc42
    
    rvm install 2.0.0 --with-gcc=gcc-4.2
    

    If this doesn't work, remove your existing rubygems and follow this:

    rvm remove 2.0.0
    rvm get head --autolibs=3
    rvm requirements
    
    #At this point, brew install anything that's missing, like apple-gcc42.
    
    rvm install 2.0.0 --with-gcc=gcc-4.2
    
    0 讨论(0)
  • 2020-12-07 08:43

    You can first install a newer openssl, as Mike Slutsky described. To check your openssl version:

    $ openssl version
    

    Get a more recent one here: http://www.openssl.org/source/ Then configure and install it:

    $ cd openssl-1.0.1f_src/
    $ ./Configure --prefix=/Users/me/bin/openssl-1.0.1f_bin darwin64-x86_64-cc
    $ make install
    

    Now configure ruby with this openssl:

    $ cd ruby-2.1.0_src/
    $ ./configure --with-openssl-dir=/Users/me/bin/openssl-1.0.1f_bin --prefix=/Users/me/bin/ruby-2.1.0_bin
    

    Note: the new openssl does not need to be on you $PATH. This worked for me with ruby 2.0 and 2.1. Good luck (-:

    0 讨论(0)
  • 2020-12-07 08:53
    rvm osx-ssl-certs update all
    

    did the trick for me, ruby 2.0.0

    0 讨论(0)
  • 2020-12-07 08:53

    This is what solved it for me: Install this certificate: https://raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem

    In this folder: {rubyfolder}\lib\ruby\2.1.0\rubygems\ssl_certs

    This way you don't have to add insecure sources.

    More info here: https://gist.github.com/luislavena/f064211759ee0f806c88

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