今天升级项目Cocoapods管理的第三方库, 用pod update --no-repo-update
更新库,有的库的版本反而降低了(团队开发),这真的是莫名其妙. 然后用了pod install
, pod install --no-repo-update
, pod update
, pod repo update
等命令,都报以下这个错误:
Failed to connect to GitHub to update the MacDownApp/cocoapods-specs specs repo - Please check if you are offline, or that GitHub is down
这个问题跟 GitHub 有关系, 主要是 GitHub.com 删除了对弱密码标准的支持:
TLSv1/TLSv1.1
, diffie-hellman-group1-sha1
, diffie-hellman-group14-sha1
https://blog.github.com/2018-02-23-weak-cryptographic-standards-removed/
然后我在 stackoverflow 上找到了该问题的解决方案,亲测可用, 现把它搬运过来, 如下(侵删):
首先更新openssl,然后更新ruby,最后升级cocoapod。
$ which openssl
/usr/bin/openssl
$ openssl version
OpenSSL 0.9.8zh 14 Jan 2016
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
$ brew install openssl
$ brew upgrade openssl
`` If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
$ source ~/.bash_profile
$ which openssl
/usr/local/opt/openssl/bin/openssl
$ openssl version
OpenSSL 1.0.2n 7 Dec 2017
$ brew install rbenv ruby-build
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ source ~/.bash_profile
$ rbenv install --list
Available versions:
1.8.5-p52
1.8.5-p113
1.8.5-p114
1.8.5-p115
1.8.5-p231
1.8.6
:
2.5.0-rc1
2.5.0
2.6.0-dev
:
$ rbenv install 2.5.0
$ rbenv versions
* system (set by /Users/username/.rbenv/version)
2.5.0
$ ruby --version
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
$ rbenv global 2.5.0
$ rbenv versions
system
* 2.5.0 (set by /Users/username/.rbenv/version)
$ ruby --version
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]
$ gem install cocoapods -n /usr/local/bin
$ which pod
/usr/local/bin/pod
$ pod --version
1.4.0