gem安装失败与openssl失败。

时间:2022-04-25 00:15:21

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

我试着在我的OSX Mountain Lion上安装cocoapods (http://cocoapods.org/)。

 moshe-mbp:~ moshem$ gem install cocoapods
 ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
      Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0      state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/latest_specs.4.8.gz)

first I tried

首先,我试着

 rvm reinstall all --force

then I tried

然后我试着

 brew upgrade openssl

    ==> Upgrading openssl
    ==> Downloading http://openssl.org/source/openssl-1.0.1e.tar.gz
    Already downloaded: /Library/Caches/Homebrew/openssl-1.0.1e.tar.gz
    ==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.1e --openssldir=/usr/local/etc/openssl zlib-dynamic shared d
    ==> make
    ==> make test
    ==> make install MANDIR=/usr/local/Cellar/openssl/1.0.1e/share/man MANSUFFIX=ssl
    ==> Caveats
    To install updated CA certs from Mozilla.org:

        brew install curl-ca-bundle

    This formula is keg-only: so it was not symlinked into /usr/local.

    Mac OS X already provides this software and installing another version in
    parallel can cause all kinds of trouble.

    The OpenSSL provided by OS X is too old for some software.

    Generally there are no consequences of this for you. If you build your
    own software and it requires this formula, you'll need to add to your
    build variables:

        LDFLAGS:  -L/usr/local/opt/openssl/lib
        CPPFLAGS: -I/usr/local/opt/openssl/include

    ==> Summary
    ????  /usr/local/Cellar/openssl/1.0.1e: 429 files, 15M, built in 5.1 minutes

I then tried

然后我试着

openssl version

and still(!) gets the older version

而且仍然(!)得到旧版本。

moshe-mbp:~ moshem$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
moshe-mbp:~ moshem$ 

what am I doing wrong? how can I install the cocoapods gem?

我做错了什么?我怎样才能装上可可豆呢?

thanks

谢谢


EDIT, trying @sean suggestion:

编辑,@sean建议:

moshe-mbp:~ moshem$ brew update
Updated Homebrew from 672af665 to 10b4d426.
==> Updated Formulae
bash        wireshark
moshe-mbp:~ moshem$ brew install openssl
Error: openssl-1.0.1e already installed
moshe-mbp:~ moshem$ brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.1e... 1139 symlinks created
moshe-mbp:~ moshem$ brew install curl-ca-bundle
Error: curl-ca-bundle-1.87 already installed
moshe-mbp:~ moshem$ 
moshe-mbp:~ moshem$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
moshe-mbp:~ moshem$ gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/latest_specs.4.8.gz)

EDIT (2) after fixing issues with brew doctor

编辑(2)与brew医生解决问题。

moshe-mbp:~ moshem$ gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/latest_specs.4.8.gz)
moshe-mbp:~ moshem$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
moshe-mbp:~ moshem$ brew update
Updated Homebrew from 10b4d426 to 6a00bc3c.
==> Updated Formulae
clozure-cl  python  python3
moshe-mbp:~ moshem$ brew install openssl
Error: openssl-1.0.1e already installed
moshe-mbp:~ moshem$ 
moshe-mbp:~ moshem$ echo $PATH
/Users/moshem/.rvm/gems/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/moshem/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/tools:/platforms:/platform-tools:
moshe-mbp:~ moshem$ 

EDIT after altering the /etc/paths

修改/etc/路径后进行编辑。

I edited the /etc/path files to:

我将/etc/path文件编辑为:

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

closed terminal completly and reopend and it still launches the old version of openssl!

关闭终端和reopend,它仍然启动旧版本的openssl!

why?

为什么?

moshe-mbp:~ moshem$ env $PATH
env: /Users/moshem/.rvm/gems/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/moshem/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/tools:/platforms:/platform-tools

EDIT, my bash_profile

编辑,我bash_profile

source "`brew --prefix grc`/etc/grc.bashrc"

export PATH=${JAVA_HOME}/bin:$PATH
export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platforms:$ANDROID_SDK/platform-tools:$ANDROID_NDK"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

BTW, the /etc/grc.bashrc doesn't seem to exist on my machine. both this line and the rvm line at the end were added by installed scripts

顺便说一句,/etc/grc.bashrc似乎不在我的机器上。这一行和最后的rvm行都是通过安装的脚本添加的。


EDIT

编辑

moshe-mbp:~ moshem$ rvm pkg install openssl 
Fetching openssl-1.0.1c.tar.gz to /Users/moshem/.rvm/archives
Extracting openssl to /Users/moshem/.rvm/src/openssl-1.0.1c
Configuring openssl in /Users/moshem/.rvm/src/openssl-1.0.1c.
Compiling openssl in /Users/moshem/.rvm/src/openssl-1.0.1c.
Installing openssl to /Users/moshem/.rvm/usr

Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

Updating openssl certificates
moshe-mbp:~ moshem$ openssl version
OpenSSL 1.0.1e 11 Feb 2013


moshe-mbp:~ moshem$ gem source -r http://rubygems.org/
http://rubygems.org/ removed from sources
moshe-mbp:~ moshem$ gem source -a https://rubygems.org/
Error fetching https://rubygems.org/:
    SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/specs.4.8.gz)
moshe-mbp:~ moshem$ gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0) in any repository

11 个解决方案

#1


77  

This is fixed by avoiding https and using the insecure http instead. Running this worked for me.

这是通过避免https和使用不安全的http来解决的。这对我来说很有效。

gem source -a http://rubygems.org/

#2


53  

rvm osx-ssl-certs update all

did the trick for me, ruby 2.0.0

对我来说有什么诀窍吗,ruby 2.0.0 ?

#3


37  

Try using http://rubygems.org/ (without SSL) as a source — that fixed the error for me.

尝试使用http://rubygems.org/(不使用SSL)作为源——为我修正错误。

gem source -r https://rubygems.org/
gem source -a http://rubygems.org/
gem install cocoapods

#4


25  

Current release of rvm does a lot better job handling this things, run:

rvm的当前版本在处理这些事情方面做得更好,运行:

rvm get head
rvm reload
rvm autolibs enable
rvm reinstall 1.9.3 --disable-binary

Make sure to follow any displayed instructions - it's all there to help you.

一定要遵循任何显示的指示——这都是为了帮助你。

#5


10  

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

这是为我解决的问题:安装这个证书: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

在这个文件夹:{ 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

更多信息:https://gist.github.com/luislavena/f064211759ee0f806c88

#6


9  

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 :)

在那之后,打开一个新的shell或源文件,所有的文件都应该很好:)

UPDATE:

更新:

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

要更新您的路径,您需要编辑/etc/path文件,这样做如下:

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/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Hope that fixes it!

希望修复它!

#7


5  

If you are in China????????, try using http://ruby.taobao.org/ as a source — that fixed the error for me. At the same time,avoid https. Running this worked for me.

如果您在中国,请尝试使用http://ruby.taobao.org/作为源代码,为我修正错误。同时,避免https。这对我来说很有效。

gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem install cocoapods

#8


4  

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:

如果这个方法不起作用,请删除您现有的rubygems并遵循以下步骤:

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

#9


2  

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

您可以首先安装一个新的openssl,就像Mike Slutsky所描述的那样。检查您的openssl版本:

$ openssl version

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

这里有一个更近期的:http://www.openssl.org/source/然后配置并安装它:

$ 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:

现在使用这个openssl配置ruby:

$ 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 (-:

注意:新的openssl不需要在您的$PATH上。这对我使用ruby 2.0和2.1是有效的。祝你好运(-:

#10


1  

You can try to update OpenSSL from source instead:

您可以尝试从源代码更新OpenSSL:

curl -L -O http://www.openssl.org/source/openssl-1.0.1b.tar.gz.asc
curl -L -O http://www.openssl.org/source/openssl-1.0.1b.tar.gz
gpg --verify openssl-1.0.1b.tar.gz.asc
tar xvzf openssl-1.0.1b.tar.gz
cd openssl-1.0.1b
perl ./Configure shared zlib --prefix=/opt/local darwin64-x86_64-cc
make
make test
sudo make install

source

#11


0  

I fixed it by only appending to the PATH variable in my ~/.bash_profile, which in my case meant changing

我只将它附加到~/的路径变量中。bash_profile,在我的情况下意味着改变。

export PATH="/usr/local/mysql/bin:$PATH"
export PATH=$M2:$PATH
export PATH=$JAVA_HOME/bin:$PATH

to

export PATH="$PATH:/usr/local/mysql/bin"
export PATH=$PATH:$M2
export PATH=$PATH:$JAVA_HOME/bin

In terminal, type nano ~/.bash_profile to start editing.

在终端,输入nano ~/。bash_profile开始编辑。

#1


77  

This is fixed by avoiding https and using the insecure http instead. Running this worked for me.

这是通过避免https和使用不安全的http来解决的。这对我来说很有效。

gem source -a http://rubygems.org/

#2


53  

rvm osx-ssl-certs update all

did the trick for me, ruby 2.0.0

对我来说有什么诀窍吗,ruby 2.0.0 ?

#3


37  

Try using http://rubygems.org/ (without SSL) as a source — that fixed the error for me.

尝试使用http://rubygems.org/(不使用SSL)作为源——为我修正错误。

gem source -r https://rubygems.org/
gem source -a http://rubygems.org/
gem install cocoapods

#4


25  

Current release of rvm does a lot better job handling this things, run:

rvm的当前版本在处理这些事情方面做得更好,运行:

rvm get head
rvm reload
rvm autolibs enable
rvm reinstall 1.9.3 --disable-binary

Make sure to follow any displayed instructions - it's all there to help you.

一定要遵循任何显示的指示——这都是为了帮助你。

#5


10  

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

这是为我解决的问题:安装这个证书: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

在这个文件夹:{ 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

更多信息:https://gist.github.com/luislavena/f064211759ee0f806c88

#6


9  

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 :)

在那之后,打开一个新的shell或源文件,所有的文件都应该很好:)

UPDATE:

更新:

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

要更新您的路径,您需要编辑/etc/path文件,这样做如下:

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/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Hope that fixes it!

希望修复它!

#7


5  

If you are in China????????, try using http://ruby.taobao.org/ as a source — that fixed the error for me. At the same time,avoid https. Running this worked for me.

如果您在中国,请尝试使用http://ruby.taobao.org/作为源代码,为我修正错误。同时,避免https。这对我来说很有效。

gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem install cocoapods

#8


4  

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:

如果这个方法不起作用,请删除您现有的rubygems并遵循以下步骤:

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

#9


2  

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

您可以首先安装一个新的openssl,就像Mike Slutsky所描述的那样。检查您的openssl版本:

$ openssl version

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

这里有一个更近期的:http://www.openssl.org/source/然后配置并安装它:

$ 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:

现在使用这个openssl配置ruby:

$ 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 (-:

注意:新的openssl不需要在您的$PATH上。这对我使用ruby 2.0和2.1是有效的。祝你好运(-:

#10


1  

You can try to update OpenSSL from source instead:

您可以尝试从源代码更新OpenSSL:

curl -L -O http://www.openssl.org/source/openssl-1.0.1b.tar.gz.asc
curl -L -O http://www.openssl.org/source/openssl-1.0.1b.tar.gz
gpg --verify openssl-1.0.1b.tar.gz.asc
tar xvzf openssl-1.0.1b.tar.gz
cd openssl-1.0.1b
perl ./Configure shared zlib --prefix=/opt/local darwin64-x86_64-cc
make
make test
sudo make install

source

#11


0  

I fixed it by only appending to the PATH variable in my ~/.bash_profile, which in my case meant changing

我只将它附加到~/的路径变量中。bash_profile,在我的情况下意味着改变。

export PATH="/usr/local/mysql/bin:$PATH"
export PATH=$M2:$PATH
export PATH=$JAVA_HOME/bin:$PATH

to

export PATH="$PATH:/usr/local/mysql/bin"
export PATH=$PATH:$M2
export PATH=$PATH:$JAVA_HOME/bin

In terminal, type nano ~/.bash_profile to start editing.

在终端,输入nano ~/。bash_profile开始编辑。