iOS 卡住在 Cloning spec repo 'cocoapods' from 'https://github.com/CocoaPods/Specs.git'

1.概况

一般是第一次安装cocoapod后, 使用pod install 或者 pod update等时候.
终端显示

Cloning spec repo 'cocoapods' from 'https://github.com/CocoaPods/Specs.git'

就不动了,也没个提示啥的,很迷

2.原因

一般来说其实是正在下载东西从github上,但是下载速度很慢

  1. 可以如下办法查看进度mac上找 活动监视器里的网络列表里找git-remote-https,这条即是当前的下载进度,可看到缓缓的在变动下载数据
  2. 何时下载完捏,这里可利用github的api查看下项目大小
    https://api.github.com/repos/CocoaPods/Specs
    这是github的api,返回一串json,是项目的相关信息.里面找size,即是项目大小,我看得750M多, so 耐心些等吧

3.解决办法

更换国内的镜像, 清华的不错

$ cd ~/.cocoapods/repos 
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

然后记得去自己项目podfile里把source换了

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

然后再重新pod update
但可能存在不最新的问题

你可能感兴趣的:(iOS 卡住在 Cloning spec repo 'cocoapods' from 'https://github.com/CocoaPods/Specs.git')