Homebrew+RVM+Ruby+CocoaPods
Xcode->homebrew->RVM->Ruby->CocoaPots;
安装ruby 先运行下面命令,再安装:
rvm autolibs read-only
# cocopods 提高 pod install速度
目前感觉最快的方式,换DNS为119.29.29.29
,如果DNS都不行的话再看👇
注:此处仅介绍CDN挂代理加速方法,如果本地有master的话,就在podFile中添加source,下面介绍的*3步骤就不要使用了*。
- 开启科学上网
- 配置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
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
- 删除pod下其他repo,保留CDN类型的trunk,可以使用
pod repo list
查看repo,使用pod repo remove master
删除master
repo - 在hosts文件中添加如下
151.101.108.133 raw.githubusercontent.com
1
其中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
1
2
3
2
3
最后进入自己的工程,在自己工程的podFile第一行加上:
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
1
缺点就是每次都要加source
上次更新: 2022/05/07, 16:05:00