gem安装失败,openssl失败
我试图在我的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$
我究竟做错了什么? 我如何安装cocoapodsgem?
谢谢
编辑,试图@seanbuild议:
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 /path后编辑
我编辑了/ etc /path文件到:
/usr/local/bin /usr/bin /bin /usr/sbin /sbin
closuresterminal完成并重新打开,它仍然推出旧版本的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
这是通过避免https和使用不安全的http来解决的。 运行这个为我工作。
gem source -a http://rubygems.org/
rvm osx-ssl-certs update all
为我做了诡计,ruby2.0.0
尝试使用http://rubygems.org/ (没有SSL)作为来源 – 为我解决了这个错误。
gem source -r https://rubygems.org/ gem source -a http://rubygems.org/ gem install cocoapods
rvm的当前版本处理这些事情做得好得多,运行:
rvm get head rvm reload rvm autolibs enable rvm reinstall 1.9.3 --disable-binary
确保遵循任何显示的说明 – 这一切都在帮助你。
这是为我解决它:安装此证书: https : //raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem
在这个文件夹中:{rubyfolder} \ lib \ ruby \ 2.1.0 \ rubygems \ ssl_certs
这样你不必添加不安全的来源。
更多信息: https : //gist.github.com/luislavena/f064211759ee0f806c88
我有同样的错误。 要解决只是运行下面的命令(我知道你跑了一些,但幽默我):
brew update brew install openssl brew link openssl --force brew install curl-ca-bundle
之后,打开一个新的shell或源文件,所有应该是好去:)
更新:
要更新你的path,你需要编辑你的/ etc /path文件,所以做一些事情:
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
希望修复它!
如果你在中国🇨🇳,请尝试使用http://ruby.taobao.org/作为源代码; – 为我解决错误。 同时,避免https。 运行这个为我工作。
gem sources --remove https://rubygems.org/ gem sources -a http://ruby.taobao.org/ gem install cocoapods
下面的一切都为我工作!
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
正如Mike Slutsky所描述的,您可以先安装一个更新的openssl。 要检查你的openssl版本:
$ openssl version
在这里获取更新的: http : //www.openssl.org/source/然后configuration和安装它:
$ cd openssl-1.0.1f_src/ $ ./Configure --prefix=/Users/me/bin/openssl-1.0.1f_bin darwin64-x86_64-cc $ make install
现在用这个opensslconfigurationruby:
$ 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的工作。 祝你好运 (-:
您可以尝试从源更新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
资源
我通过在我的〜/ .bash_profile中附加PATHvariables来修复它,在我的情况下这意味着改变
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
在terminal中,inputnano ~/.bash_profile
开始编辑。