cocoapods 安装 pod setup 很慢的解决方案

cocoapods 是什么?

cocoapods 是第三方开源库管理库工具,类似于 JAVA 中的 Maven。
官方解释:https://cocoapods.org/

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 65 thousand libraries and is used in over 3 million apps. CocoaPods can help you scale your projects elegantly.

CocoaPods是 Swift 和 Objective-C Cocoa项目的依赖管理器。它拥有超过65,000个库,并在超过300万个应用程序中使用。CocoaPods 可以帮助您优雅地扩展项目。

在 ped setup 安装的时候,超级无敌慢,clone 速度是 7.00 KiB/s,实在是不敢恭维,得下到猴年马月。它也是从 github 上进行 clone 的啊,但为何就是这么慢呢。

安装说明

首先进入 cocoapods 安装的目录,默认在 ~/.cocoapods 目录中,如果执行 setup 应该有一个叫 repos 的文件夹,没有就建一个。如果有其他文件夹请删掉。

按照下方提供的 git 地址进行 clone,然后把 Specs 文件夹改名为:master

官方 github

git clone https://github.com/CocoaPods/Specs.git

国内清华大学镜像(可用)

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

上海大学镜像(废的)

https://mirrors.shu.edu.cn/CocoaPods (仅HTTP/HTTPS访问,不支持git拉取)
https://mirrors.shu.edu.cn/mgit/Specs (仅git访问)
https://git.shuosc.org/CocoaPods/Specs (均支持)

国内镜像(感觉没更新)

https://coding.net/u/CocoaPods/p/Specs/git
https://code.aliyun.com/Magi/CocoaPods.git
https://gitclub.cn/CocoaPods/Specs.git

git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
Cloning into 'Specs'...
remote: Counting objects: 3460294, done.
remote: Compressing objects: 100% (1061357/1061357), done.
remote: Total 3460294 (delta 2201330), reused 3450307 (delta 2193665)
Receiving objects: 100% (3460294/3460294), 601.41 MiB | 8.91 MiB/s, done.
Resolving deltas: 100% (2201330/2201330), done.
Checking out files: 100% (358853/358853), done.

使用的清华大学镜像,速度快多了,终端输入:pod repos

master
- Type: git (master)
- URL: https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
- Path: /Users/xxx/.cocoapods/repos/master

1 repo

以上信息说明已经 setup 成功了。然后就可以到工程目录下 pod install 了。

pod --version # 查看版本
1.7.5

至于它的完整性以及是否最新版本,请自行检查。

技术笔记

SVN 项目迁址至 Gitlab 完整步骤

2020-3-13 16:57:51

后端开发技术笔记

iReport 5.6.0 安装完后无法打开解决方案

2020-5-14 13:24:44

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索