美文网首页
cocopods 提高 pod install速度

cocopods 提高 pod install速度

作者: smallLabel | 来源:发表于2020-05-09 14:19 被阅读0次

目前感觉最快的方式,换DNS为119.29.29.29,如果DNS都不行的话再看👇

注:此处仅介绍CDN挂代理加速方法,如果本地有master的话,就在podFile中添加source,下面介绍的3步骤就不要使用了

  1. 开启科学上网
  2. 配置git 代理
// 注意端口号不一定必须是1080
// 以下两种设置代理的方式二选一,推荐设置socks5
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080

git config --global --unset http.proxy // 取消代理
git config --global --unset https.proxy // 取消代理
  1. 删除pod下其他repo,保留CDN类型的trunk,可以使用pod repo list查看repo,使用pod repo remove master删除masterrepo
  2. 在hosts文件中添加如下
151.101.108.133 raw.githubusercontent.com

其中IP可能会发生变化,可以上这个网站查询域名对应IP

PS:

  • 如果在pod install时出现JSON::ParserError - 767: unexpected token at '.....一大堆错误,可以把~/.cocoapods/repos/目录下的所有文件全部删除,重新执行pod install命令,多试几次😎

  • 如果觉得上面的太麻烦,也没代理可用,那就试试清华源镜像
    吧。

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

最后进入自己的工程,在自己工程的podFile第一行加上:

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

缺点就是每次都要加source

相关文章

网友评论

      本文标题:cocopods 提高 pod install速度

      本文链接:https://www.haomeiwen.com/subject/vcxknhtx.html