ios cocoapods - 'pod install' 需要永远
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23755974/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cocoapods - 'pod install' takes forever
提问by Hai Feng Kao
I was trying to update the existing pods with pod install
command, but it takes forever to run.
我试图用pod install
命令更新现有的 pod ,但它需要永远运行。
The verbose mode shows it was stuck at the following line (forever)
详细模式显示它卡在下一行(永远)
Updating spec repo
master
$ /usr/bin/git pull --no-rebase --no-commit
更新规范仓库
master
$ /usr/bin/git pull --no-rebase --no-commit
There are no network activity after it get stuck.
卡住后没有网络活动。
回答by lmnbeyond
回答by abbood
you can run
你可以跑
pod install --verbose
to see what's going on behind the scenes.. at least you'll know where it's stuck at (it could be a git clone operation that's taking too long because of your slow network etc)
看看幕后发生了什么……至少你会知道它卡在哪里(它可能是一个 git clone 操作,由于你的网络速度慢等而花费了太长时间)
to have an even better idea of why it seems to be stuck (running verbose can get you something like this
更好地了解为什么它似乎卡住了(运行详细可以让你得到这样的东西
-> 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'...
is to find out the size of the git repo you're cloning.. if you're cloning from github.. you can use this format:
是找出您要克隆的 git repo 的大小.. 如果您从 github 克隆.. 您可以使用以下格式:
/repos/:user/:repo
so, for example, to find out about the above repo type
因此,例如,要了解上述 repo 类型
https://api.github.com/repos/typhoon-framework/Typhoon
and the returned JSON will have a size key, value. so the above returned
并且返回的 JSON 将有一个大小键值。所以上面的返回
"size": 94014,
which is approx 90mb. no wonder it's taking forever! (btw.. by the time I wrote this.. it just finished.. ha!)
这是大约 90mb。难怪它需要永远!(顺便说一句......当我写这篇文章的时候......它刚刚完成......哈!)
update:one common thing that cocoa pods do beforeit even starts downloading the dependencies listed in your podfile, is to download/update its own repo (they call it Setting up Cocoapods Master repo.. look at this:
更新:可可豆荚在开始下载您的 podfile 中列出的依赖项之前所做的一件常见事情是下载/更新它自己的 repo(他们称之为设置 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
..
the bad news is that if you follow the above procedure to find out how big the cocoa pod repo is.. you'll get this: "size": 614373,.. which is a lot.
坏消息是,如果你按照上面的过程,找出可可豆荚回购多大..你会得到这样:“大小”:614373,..这是很多。
so to get a more accurate way of knowing how long it takes to just install your own repo.. you can set up the cocoa pods master repo separately by using pod setup
:
所以为了更准确地了解安装自己的仓库需要多长时间..您可以使用pod setup
以下命令单独设置可可豆主仓库:
$ 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.
then running pod install
然后运行 pod install
回答by E-Riddie
Possible solutions:
可能的解决方案:
- Updating Cocoa Pods may solve this issue
- Clean and fresh install pods again
- 更新 Cocoa Pods 可能会解决这个问题
- 再次清洁和全新安装 Pod
Updating CocoaPods
更新 CocoaPods
Open terminal and type:
打开终端并输入:
$ sudo gem update cocoapods
Reinstall Pods
重新安装 Pod
Step 1
第1步
Remove all the pods from your project (tricky part):
从您的项目中删除所有 pod(棘手的部分):
Manually
手动
- Remove all Pods records on Build Phasesof your project (Marked Red)
- 删除项目构建阶段的所有 Pods 记录(标记为红色)
- Remove libPods.aunder Frameworksfolder
- 删除Frameworks文件夹下的libPods.a
- Now head to project directory and remove Podfile.lock*, **Podsfolder and Workspace (Remove from Trashtoo).
- 现在前往项目目录并删除Podfile.lock*、**Pods文件夹和工作区(也从垃圾箱中删除)。
Automatically using CocoaPods De-Integrate
Install
安装
$ [sudo] gem install cocoapods-deintegrate
Run
跑
$ pod deintegrate
Step 2
第2步
Here we are going through at installing the Pods again
在这里,我们将再次安装 Pod
Changeyour location your directory
更改您的位置您的目录
$ cd yourprojectdirectory
Editpodfile by adding lines you need to it
通过添加您需要的行来编辑podfile
$ open -a Xcode podfile
or
或者
$ nano podfile
FINALLYinstall the pod again
最后再次安装 pod
$ pod install
Hope this helps
希望这可以帮助
回答by wossoneri
I found another way to solve the problem
我找到了另一种解决问题的方法
pod install --verbose --no-repo-update
pod install --verbose --no-repo-update
it works for me.
这个对我有用。
回答by 209135
As of 15th August 2016, the repo is a massive 2.39GB file. I opened the Activity Monitor to look at what the terminal was doing. It was downloading this huge file.
截至 2016 年 8 月 15 日,repo 是一个巨大的 2.39GB 文件。我打开活动监视器查看终端在做什么。它正在下载这个巨大的文件。
回答by syonip
Updated answer for 2019 - the cocoa pods team moved to using their own CDN which solves this issue, which was due to GitHub rate limiting, as described here: https://blog.cocoapods.org/CocoaPods-1.7.2/
2019 年的更新答案 - Cocoa Pods 团队转而使用他们自己的 CDN 解决了这个问题,这是由于 GitHub 速率限制,如下所述:https: //blog.cocoapods.org/CocoaPods-1.7.2/
TL;DR
You need to change the source line in your Podfile
to this:
TL;DR 您需要将源代码行更改为Podfile
:
source 'https://cdn.cocoapods.org/'
回答by Ammar Mujeeb
As pointed out here git-remote-http process running in background. I goto this process from Activity Monitor and quitting this process resumed the pod process which was stuck on "Updating local specs repositories" after POD INSTALL
正如这里指出的git-remote-http 进程在后台运行。我从活动监视器转到这个过程,退出这个过程恢复了在 POD INSTALL 后卡在“更新本地规范存储库” 上的 pod 进程
回答by ArdenDev
This is what worked for me :
这对我有用:
- Delete all the content under
~/.CocoaPods
- Delete your existing
Podfile.lock
andPods
folder. - Leave your PodFile intact.
- Run
sudo gem install cocoapods --verbose
- Run
pod install --verbose
- 删除下所有内容
~/.CocoaPods
- 删除现有
Podfile.lock
和Pods
文件夹。 - 保持 PodFile 完好无损。
- 跑
sudo gem install cocoapods --verbose
- 跑
pod install --verbose
I recommend using the --verbose flag since Terminal is not great when giving progress on a command action. The verbose option helps a lot!
我建议使用 --verbose 标志,因为终端在给出命令操作的进度时不是很好。详细选项有很大帮助!
回答by Harshal Wani
Just go through the below step-by-step:
只需逐步完成以下操作:
Download https://github.com/CocoaPods/Specs/archive/master.zip
下载https://github.com/CocoaPods/Specs/archive/master.zip
RUN the Below commands in terminal:
在终端中运行以下命令:
pod setup --verbose
pod setup --verbose
Open new tab in the terminal and RUN
在终端中打开新标签并运行
mv ~/.cocoapods/repos/master/.git ~/tempSpecsGitFolder
mv ~/.cocoapods/repos/master/.git ~/tempSpecsGitFolder
open master.zip (unzipping it)
打开 master.zip(解压)
mv Specs-master ~/.cocoapods/repos/master
mv Specs-master ~/.cocoapods/repos/master
mv ~/tempSpecsGitFolder ~/.cocoapods/repos/master/.git
mv ~/tempSpecsGitFolder ~/.cocoapods/repos/master/.git
cd [project folder]
cd [项目文件夹]
pod install --no-repo-update
pod install --no-repo-update