首先MAC自带了ruby,他是用rvm 管理的, 如果你用homebrew又安装了一个新版,很可能在升级cocoapods时遇到问题,明明自己用homebrew升级到最新版本了,页配置环境变量了,为什么还是无法升级cocoapods?

  因为系统默认还是用

要用到一个气泡显示器,用了git上面的一个第三方库

执行pod install 命令报错:

$ pod install

Analyzing dependencies

[!] Unable to satisfy the following requirements:

- `LFKit/Component/LFBubbleView` required by `Podfile`

None of your spec sources contain a spec satisfying the dependency: `LFKit/Component/LFBubbleView`.

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.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

然后,我按照提示输入命令:

$pod update --verbose

Update all pods

Preparing

Updating local specs repositories

Updating spec repo `master`

[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down

后面还吐了一大堆,

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-core-1.3.1/lib/cocoapods-core/github.rb:105:in `rescue in modified_since_commit'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-core-1.3.1/lib/cocoapods-core/github.rb:100:in `modified_since_commit'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-core-1.3.1/lib/cocoapods-core/source.rb:445:in `unchanged_github_repo?'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-core-1.3.1/lib/cocoapods-core/source.rb:334:in `update'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/sources_manager.rb:88:in `block (2 levels) in update'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in `section'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/sources_manager.rb:87:in `block in update'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/sources_manager.rb:86:in `each'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/sources_manager.rb:86:in `update'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:237:in `block in update_repositories'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:235:in `each'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:235:in `update_repositories'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:150:in `block in resolve_dependencies'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in `section'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:149:in `resolve_dependencies'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:116:in `install!'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/command/update.rb:81:in `run'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'

/Users/username/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.3.1/bin/pod:55:in `<top (required)>'

/Users/username/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `load'

/Users/username/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `<main>'

主要意思是说,要么你网络有问题,要么是GitHub挂了。

pod update 命令执行不成功,自然无法更新最新的 cocoapods 库索引了。

从提示信息上看,我的ruby 是 2.4.1, cocoapods 版本是1.3.1,算是比较新的了。

最后发现是Github在不久之前的2018年2月23号移除了一些低加密标准协议,包括TLSv1/TLSv1.1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,相关链接在这里:Weak cryptographic standards removed, 看GitHub的官方公告。

stackoverflow上已经有了解决方法:大致流程是:

$ 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
//这里可能 会跟你自己安装ruby的方式冲突,请看文章最后, 建议用 rvm 就用rvm, 用rbenv 就卸载rvm 再安装 rbenv,二选一
$ 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

https://stackoverflow.com/questions/38993527/cocoapods-failed-to-connect-to-github-to-update-the-cocoapods-specs-specs-repo/48962041#48962041

但是我按照这些方法还是不行,原因可能是,我安装或升级pods时用的是 rvm管理的,再次升级安装,它会自动用用ruby 2.4.1 。而不会用brew安装的 2.5.1 。

使用命令:$ ruby --version

ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]

发现确实是  bash 引用的还是 ruby 2.4.1

最后我觉得应该把 rvm 管理的系统ruby升级:

可以使用rvm来更新管理ruby。
安装rvm
使用命令  $ curl -L http://get.rvm.io | bash -s stable
列出ruby可安装版本 rvm list known
安装一个需要的ruby版本 rvm install 2.5.0
 
之前openssl是用brew来安装的。
 

$ brew upgrade openssl

但是在

rvm install 2.5.0 命令执行过程中发现, 他自动 升级了homebrew, 然后升级了 openssl到1.1  总之,这个 github加密升级的东西是搞定了。

 

Updating Homebrew...

==> Upgrading 3 outdated packages, with result:

coreutils 8.28_1 -> 8.29, openssl@1.1 1.1.0f -> 1.1.0h, automake 1.15.1 -> 1.16.1

==> Upgrading openssl@1.1 

==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.0h.high_sie

######################################################################## 100.0%

==> Pouring openssl@1.1-1.1.0h.high_sierra.bottle.tar.gz

ruby 安装成功之后,
再执行 $pod repo update master --verbose  就可以升级索引库了。
看到绿字提示:
 

CocoaPods 1.5.0 is available.

To update use: `sudo gem install cocoapods`

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.5.0

证明升级成功。
最后可以发现,还是熟悉的味道,还是原来的配方:
$pod install 
 

Pod installation complete! There are 11 dependencies from the Podfile and 11 total pods installed.

还有一个问题, 在不同的 bash 命令里,假如在一个terminal里ruby没升级,另一个升级了,发现 $ruby --version 显示的ruby的不一样:

关于ruby 多版本的问题以后再做探讨,似乎有一个管理多版本ruby的第三方库。

给几个链接自己看看
https://www.cnblogs.com/supper-Ho/p/6414647.html 
https://www.v2ex.com/t/396846
从大家的讨论看出 用rvm会好点。 brew似乎会单独维护一个版本。
 
补充:
以上教程中使用了rbenv, 这个东西和rvm 是冲突的不能同时安装,请在使用前把rvm 卸载干净, 再安装rbenv。ruby-china社区里也有该方面的说明。
 

cocoapods 无法 升级 repo 无法执行pod install命令的更多相关文章

  1. iOS 开发】解决使用 CocoaPods 执行 pod install 时出现 - Use the `$(inherited)` flag ... 警告

    公司项目在执行 pod install 的时候总是出现很多黄色的警告,因为是警告并不会影响项目的正常编译,一直没有在意,但是总是有很多警告看起来很不舒服,于是就花了点时间解决掉了,下面将解决方法记录下 ...

  2. 利用cocoapods管理开源项目,支持 pod install安装整个流程记录(github公有库)

    利用cocoapods管理开源项目,支持 pod install安装整个流程记录(github公有库),完成预期的任务,大致有下面几步: 1.代码提交到github平台 2.创建.podspec 3. ...

  3. 请使用管理员权限执行pip install命令

    重要的事情说三遍! 请使用管理员权限执行pip install命令 请使用管理员权限执行pip install命令 请使用管理员权限执行pip install命令 踩坑记录 当时一切还是从一题Misc ...

  4. IDEA -01 -忽略指定文件夹 -防止加载Vue-cli执行"npm install"命令后的项目时卡死

    问题描述 Vue的"npm install" 命令执行后,会生成一个很大的目录层次的"node_modules",文件十分繁多; idea加载这个项目下的文件夹 ...

  5. jenkins执行 pod install 报错 CocoaPods requires your terminal to be using UTF-8 encoding. Consider adding the following to ~/.profile:

    错误提示是: CocoaPods 需要终端使用utf-8编码 解决办法

  6. Xcode9,cocoaPod执行pod install时报错,一行命令即可解决。

  7. eclipse执行maven install命令时跳过test

    在pom.xml里面配置一下代码,将跳过test. <plugins> <plugin> <groupId>org.apache.maven.plugins< ...

  8. pod install vs pod update

    Podfile文件,Podfile.lock文件 Podfile文件:指定依赖库的版本规则 Podfile.lock文件:记录当前工程中使用的依赖库的版本号 pod install会去安装podfil ...

  9. CocoaPods pod install/pod update更新慢的问题

    CocoaPods pod install/pod update   最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing d ...

随机推荐

  1. imp-oracle10g数据库dmp导入到11g数据库提示IMP-00058,表或试图不存在

    拿了一份从10g数据库导出的dmp,本机安装的是11.2g的oracle数据库,执行imp导入后提示: IMP-00058: 遇到 ORACLE 错误 942ORA-00942: 表或视图不存在 开始 ...

  2. 收藏清单: python测试数据生成及代码扫描最全工具列表

    Test Data manipulation 测试数据的操作和处理 faker - 生成假数据的python库 fake2db - 创建假数据库 ForgeryPy - 使用起来很简单的假数据生成库. ...

  3. Netty+MUI从零打造一个仿微信的高性能聊天项目,兼容iPhone/iPad/安卓

    要说到微信,我相信是个人都应该知道,几乎人人都会安装这款社交APP吧,它已经成为了我们生活中不可缺少的一份子. 我记得我上大学那会刚接触Java,做的第一个小项目就是基于J2SE的聊天室,使用Java ...

  4. [k8s]jenkins配合kubernetes插件实现k8s集群构建的持续集成

    另一个结合harbor自动构建镜像的思路: 即code+baseimage一体的方案 - 程序员将代码提交到代码仓库gitlab - 钩子触发jenkins master启动一次构建 - jenkin ...

  5. Fluent动网格【7】:网格节点运动

    在动网格中,对于那些既包含了运动也包含了变形的区域,可以通过UDF来指定区域中每一个节点的位置.这给了用户最大的自由度来指定网格的运动.在其他的动网格技术中(如重叠网格)则很难做到这一点.定义网格节点 ...

  6. SDL获得屏幕属性及实现分析

    [时间:2017-05] [状态:Open] [关键词:sdl2,屏幕分辨率,显示区域,多媒体渲染,窗口,sdl2源码分析] 0 引言 本文的主要目标在于使用SDL2获得屏幕相关的属性,比如分辨率.屏 ...

  7. Java 继承中构造方法的执行顺序问题

    在Java中,如果一个类没有任何显式创建的构造器则该类默认会有一个无参构造器:如果显式创建了有参构造器则该类就不再有默认无参构造器. 在Java继承中,构造器并不能被继承,而是被显示或隐式调用. 1. ...

  8. 史上最详细的JavaScript事件使用指南

    事件流 事件流描述的是从页面中接收事件的顺序,IE和Netscape提出来差不多完全相反的事件流的概念,IE事件流是事件冒泡流,Netscape事件流是事件捕获流. 事件冒泡 IE的事件流叫做事件冒泡 ...

  9. (原)java 向上转型中,任何域的访问操作都是由编译器解析,不是多态

    最近在向java发力,学习学习了下.看到了多态这一节,书中有个比较好的例子,所以就准备写下来,记录下来: package dynamic_binding01; public class dynamic ...

  10. Spark学习笔记——手写数字识别

    import org.apache.spark.ml.classification.RandomForestClassifier import org.apache.spark.ml.regressi ...