pod install 速度慢解决办法

首先我们查看gem使用源, 如果是淘宝源,请替换为:https://gems.ruby-china.com/

$gem sources --remove https://rubygems.org/
$gem sources -a https://gems.ruby-china.com
$gem sources -l
https://gems.ruby-china.com/

更新cocoapods

// 如果之前有
$sudo gem uninstall cocoapods (移除原来的cocoapods)
// 安装CocoaPods(OS X 10.11以前)
$sudo gem install cocoapods
// 安装CocoaPods(10.11后苹果升级了安全策略)
$sudo gem install -n /usr/local/bin cocoapods

cocoapod使用国内镜像

$pod repo remove master
$pod repo add master https://gitee.com/mirrors/CocoaPods-Specs.git
$pod repo
master
- Type: git (unknown)
- URL:  https://gitee.com/mirrors/CocoaPods-Specs.git
- Path: /Users/channel-joyce/.cocoapods/repos/master

trunk
- Type: CDN
- URL:  https://cdn.cocoapods.org/
- Path: /Users/channel-joyce/.cocoapods/repos/trunk

pod install 尽量使用:

$pod install --no-repo-update

使用proxychains使终端命令走代理

最后,如果还是慢,真正的解决方案就是要加快git命令的速度。

我使用Shadow小飞书socks代理,默认代理端口为1080,配置好代理之后去终端输入git配置命令,命令如下

$git config --globalhttp.proxy socks5://127.0.0.1:1080

上面的命令是给git设置全局代理,但是我们并不希望国内git库也走代理,而是只需要github上的代码库走代理,命令如下

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

如此就从根本上解决了问题

体验xiu的一下吧!

ps:如果要恢复/移除上面设置的git代理,使用如下命令

$git config --global --unset http.proxy
//[github.com.proxy](http://github.com.proxy/)
$git config --global --unset http.https:

参考链接:
https://blog.csdn.net/devday/article/details/105134394
https://www.cnblogs.com/dabaomo/p/9634727.html



作者:冲云简
链接:https://www.jianshu.com/p/fef9e3fd93b1
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
posted @ 2021-02-06 01:00  迷你淘  阅读(1020)  评论(0)    收藏  举报