你可以跑
pod install --verbose
看看幕后发生了什么......至少你会知道它卡在哪里(它可能是一个 git clone 操作,由于你的网络速度太慢等而花费了太长时间)
更好地了解为什么它似乎被卡住了(运行详细可以让你得到这样的结果
-> 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 repo 的大小。如果你是从 github 克隆的。你可以使用这个format:
/repos/:user/:repo
所以,例如,找出上面的repo类型
https://api.github.com/repos/typhoon-framework/Typhoon
并且返回的 JSON 将有一个大小键值。所以上面返回了
"size": 94014,
大约 90mb。难怪它需要永远! (顺便说一句..当我写这篇文章的时候..它刚刚完成..哈!)
更新:
可可豆荚在开始下载您的 podfile 中列出的依赖项之前做的一件常见事情是下载/更新自己的 repo(他们称之为Setting up Cocoapods Master 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
..
坏消息是,如果您按照上述程序找出可可豆仓库有多大.. 您将得到 this: "size": 614373,.. 很多。
因此,为了更准确地了解安装您自己的 repo 需要多长时间。您可以使用 pod setup 单独设置 cocoa pods master repo:
$ 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.
然后运行pod install