今天 $ pod install
时报错
[!] CocoaPods could not find compatible versions for pod "CL_ShanYanSDK":
In snapshot (Podfile.lock):
CL_ShanYanSDK (= 2.3.1.3, ~> 2.3.1.3)
In Podfile:
CL_ShanYanSDK (~> 2.3.1.3)
None of your spec sources contain a spec satisfying the dependencies: `CL_ShanYanSDK (~> 2.3.1.3), CL_ShanYanSDK (= 2.3.1.3, ~> 2.3.1.3)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
正常的输入 $ pod repo update
这次却报错
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down
查查资料,需要更新Mac系统对应的openssl,好吧,搬运工上线
1.$ which openssl
输出 /usr/bin/openssl
2.$ openssl version
输出 LibreSSL 2.8.3
3./usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
这一步如果报错
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
原因
由于某些“因素”,导致GitHub的raw.githubusercontent.com域名解析被污染了。
查询真实IP
在 https://www.ipaddress.com/ 查询raw.githubusercontent.com的真实IP。
修改hosts
$ sudo vi /etc/hosts
并输入密码
vim 编辑 host 添加 199.232.28.133 raw.githubusercontent.com
ESC退出编辑模式,再输入
:wq
保存并退出,再次输入/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
成功执行后需要点击回车
4.更新 brew
$ brew update
如果报错
[Error: /usr/local must be writable!](http://securityer.lofter.com/post/1d0f3ee7_bcf5f05)
5.安装 openssl
$ brew install openssl
$ brew upgrade openssl
6. If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
$ which openssl
输出 /usr/bin/openssl
$ 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.1.1g 21 Apr 2020
7. 更新ruby
$ 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
$ ruby --version
输出:ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
$ rvm list known
查看最新版本列表
$ rvm install 2.7
如果报错:
Error running 'requirements_osx_brew_update_system ruby-2.7.0
参考:http://www.cnblogs.com/yajunLi/p/8484607.html
$ ruby --version
输出 ruby 2.7.0preview1 (2019-05-31 trunk c55db6aa271df4a689dc8eb0039c929bf6ed43ff) [x86_64-darwin19]
8.更新 cocoapods
$ gem install cocoapods -n /usr/local/bin
$ pod --version
输出 1.9.3
9.最后进入项目
$ pod repo update
$ pod install