我试图用pod安装命令更新现有的pod,但它需要很长时间才能运行。

verbose模式显示它被卡在下一行(永远)

更新规范回购主机 $ /usr/bin/git pull -no-rebase -no-commit

在它被卡住之后就没有网络活动了。


当前回答

找到了另一种下载cocoapods的方法,就是下载这里提供的快照之一。它有点旧,但是.bz2压缩文件下载起来要快得多。一旦我下载了它,我将它复制到~/。cocoapods/repos/然后我使用bzip2 -dk *.bz2解压缩它。

解压缩需要一段时间,完成后,我将新解压缩文件的扩展名更改为.tar,并执行tar xvf *.tar来解压缩。这将显示正在创建的文件列表,也需要一段时间。

Finally when I ran pod repo list while inside the project folder, it showed the master folder had been added as a repo. Because I still kept getting an error that it was unable to find the specification for the pod I was looking for, I went to the master folder and did git fetch and then git merge. The git fetch took the longest, about an hour at 50 KB/s. I used fetch and merge instead of pull, as I was having issues with it, i.e. fatal: the remote end hung up unexpectedly. It is now up to date and I was able to get the pod I wanted.

其他回答

你可以跑

pod install --verbose 

看看幕后发生了什么。至少你会知道它卡在哪里(它可能是一个git克隆操作,因为你的网络慢等花费了很长时间)

为了更好地了解为什么它似乎被卡住了(运行冗长会让你得到这样的东西)

-> Installing Typhoon (2.2.1)
 > GitHub download
 > Creating cache git repo (~/Library/Caches/CocoaPods/GitHub/0363445acc1ed036ea1f162b4d8d143134f53b92)
 > Cloning to Pods folder
       $ /usr/bin/git clone https://github.com/typhoon-framework/Typhoon.git ~/Library/Caches/CocoaPods/GitHub/0363445acc1ed036ea1f162b4d8d143134f53b92 --mirror
       Cloning into bare repository '~/Library/Caches/CocoaPods/GitHub/0363445acc1ed036ea1f162b4d8d143134f53b92'...

就是找出你正在克隆的git回购的大小。如果你从github克隆..你可以使用这种格式:

/repos/:user/:repo

因此,例如,找出关于上述回购类型

https://api.github.com/repos/typhoon-framework/Typhoon

返回的JSON将有一个大小键,value。所以上面的返回

"size": 94014,

大约是90mb。难怪要花这么长时间!(顺便说一句. .在我写这篇文章的时候…刚刚结束。哈!)


更新: 一个常见的事情,可可豆荚做之前,它甚至开始下载的依赖列在你的podfile,是下载/更新自己的repo(他们称之为设置Cocoapods主repo..看看这个:

pod install --verbose

Analyzing dependencies

Updating spec repositories
  $ /usr/bin/git rev-parse  >/dev/null 2>&1
  $ /usr/bin/git ls-remote
  From https://github.com/CocoaPods/Specs.git
  09b0e7431ab82063d467296904a85d72ed40cd73  HEAD
  ..

坏消息是,如果你按照上面的程序来找出可可荚回购有多大..你会得到这个:"size": 614373,..这是很多。

因此,要获得一个更准确的方法,知道需要多长时间才安装自己的repo..你可以使用pod setup单独设置cocoa pods主回购:

$ pod help setup
Usage:

$ pod setup

  Creates a directory at `~/.cocoapods/repos` which will hold your spec-repos.
  This is where it will create a clone of the public `master` spec-repo from:

      https://github.com/CocoaPods/Specs

  If the clone already exists, it will ensure that it is up-to-date.

然后运行吊舱安装

可能的解决方式:

更新Cocoa Pods可以解决这个问题 重新清洁和新鲜的安装舱


更新CocoaPods

开端子及类型:

$ sudo gem update cocoapods

重新安装豆荚

步骤1

从你的项目中删除所有的豆荚(棘手的部分):

手动

删除项目构建阶段的所有pod记录(红色标记)

删除libPods。在Frameworks文件夹下的a

现在转到项目目录并删除Podfile。锁定*,**Pods文件夹和工作区(从垃圾中删除)。

自动使用CocoaPods去集成

安装

$ [sudo] gem install cocoapods-deintegrate

Run

$ pod deintegrate

步骤2

在这里,我们将再次安装Pods

更改您的位置和目录

$ cd yourprojectdirectory

通过添加你需要的行来编辑podfile

$ open -a Xcode podfile 

or

$ nano podfile

最后再次安装吊舱

$ pod install

希望这能有所帮助

找到了另一种下载cocoapods的方法,就是下载这里提供的快照之一。它有点旧,但是.bz2压缩文件下载起来要快得多。一旦我下载了它,我将它复制到~/。cocoapods/repos/然后我使用bzip2 -dk *.bz2解压缩它。

解压缩需要一段时间,完成后,我将新解压缩文件的扩展名更改为.tar,并执行tar xvf *.tar来解压缩。这将显示正在创建的文件列表,也需要一段时间。

Finally when I ran pod repo list while inside the project folder, it showed the master folder had been added as a repo. Because I still kept getting an error that it was unable to find the specification for the pod I was looking for, I went to the master folder and did git fetch and then git merge. The git fetch took the longest, about an hour at 50 KB/s. I used fetch and merge instead of pull, as I was having issues with it, i.e. fatal: the remote end hung up unexpectedly. It is now up to date and I was able to get the pod I wanted.

我是这样解决这个问题的:

rm -fr ~/Library/Caches/CocoaPods && \
gem update --system && \
gem update && \
gem cleanup && \
pod setup

参考:http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/

我也有同样的问题,然后我意识到我仍然在“非常糟糕的网络”上运行网络调节器。把它关掉就解决了问题。

希望这能帮助到别人。