我尝试在我的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)
首先我尝试了
rvm reinstall all --force
然后我试了
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
然后我尝试了
openssl version
并且仍然(!)获取旧版本
moshe-mbp:~ moshem$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
moshe-mbp:~ moshem$
我做错了什么?我该如何安装cocoapods gem?
感谢
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)
在解决布鲁医生问题后编辑(2)
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$
在更改/ etc / paths
后编辑我将/ etc / path文件编辑为:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
关闭终端completly并重新打开,它仍然启动旧版本的openssl!
为什么?
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
编辑,我的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*
顺便说一下,我的机器上似乎没有/etc/grc.bashrc。此行和末尾的rvm行都是通过已安装的脚本添加的
修改
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
答案 0 :(得分:78)
这可以通过避免使用https并使用不安全的http来解决。运行这个对我有用。
gem source -a http://rubygems.org/
答案 1 :(得分:54)
rvm osx-ssl-certs update all
为我做了诀窍,ruby 2.0.0
答案 2 :(得分:37)
尝试使用http://rubygems.org/(不使用SSL)作为来源 - 为我修复错误。
gem source -r https://rubygems.org/
gem source -a http://rubygems.org/
gem install cocoapods
答案 3 :(得分:25)
当前发布的rvm可以更好地处理这些事情,运行:
rvm get head
rvm reload
rvm autolibs enable
rvm reinstall 1.9.3 --disable-binary
请务必遵循任何显示的说明 - 这一切都可以帮助您。
答案 4 :(得分:11)
我有同样的错误。要解决只是运行以下命令(我知道你已经运行了一些,但幽默我):
brew update
brew install openssl
brew link openssl --force
brew install curl-ca-bundle
之后,打开一个新的shell或获取你的文件,所有这些都应该是好的:)
更新:
要更新路径,您需要编辑/ etc / paths文件,以便执行以下操作:
sudo vim /etc/paths
应该看起来像:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
您要做的是确保/usr/local/bin
位于文件的顶部。所以将它改为:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
希望能解决它!
答案 5 :(得分:10)
这就是为我解决的问题: 安装此证书:https://raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem
在此文件夹中: {rubyfolder} \ lib中\红宝石\ 2.1.0 \的rubygems \ ssl_certs
这样您就不必添加不安全的来源。
此处有更多信息:https://gist.github.com/luislavena/f064211759ee0f806c88
答案 6 :(得分:5)
如果你在中国, 尝试使用http://ruby.taobao.org/作为来源 - 为我修复错误。 同时,避免使用https。运行这对我有用。
gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem install cocoapods
答案 7 :(得分:4)
以下让一切都适合我!
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
如果这不起作用,请删除现有的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
答案 8 :(得分:2)
你可以先安装一个较新的openssl,正如Mike Slutsky所描述的那样。 要检查您的openssl版本:
$ openssl version
在此处获取更新的内容: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
现在使用此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
注意:新的openssl不需要在$ PATH上。 这对我来说适用于ruby 2.0和2.1。祝你好运( - :
答案 9 :(得分:1)
您可以尝试从源代码更新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
答案 10 :(得分:0)
我修改它只是附加到〜/ .bash_profile中的PATH变量,在我的例子中意味着改变
export PATH="/usr/local/mysql/bin:$PATH"
export PATH=$M2:$PATH
export PATH=$JAVA_HOME/bin:$PATH
到
export PATH="$PATH:/usr/local/mysql/bin"
export PATH=$PATH:$M2
export PATH=$PATH:$JAVA_HOME/bin
在终端中,输入nano ~/.bash_profile
开始编辑。