brew安装
1、
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
2、
brew install ruby
查看ruby源 gem sources -l
显示
*** CURRENT SOURCES ***
https://rubygems.org/
替换源
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
再次查看源验证是否替换成功
3、
brew install cocoapods
pod setup
如果 pod search 不到东西,执行下面的步骤
1.如果是新系统直接:原文:blog.csdn.net/m0_37677536…
终端执行 : cd ~/.cocoapods/repos
如果没有目录则执行 : mkdir -p ~/.cocoapods/repos/
然后再执行: cd ~/.cocoapods/repos
如果repos目录不为空执行: rm -rf ./*
删除当前目录下文件,否则无法clone
确保在repos目录下(执行pwd可以查看),并且为空(执行ls可以查看),然后再把仓库载下来 : 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 ‘https://github.com/CocoaPods/Specs.git’
这个默认镜像路径注释掉
加入以后长这样子:
image.png
然后直接运行:pod update 就可以了,只要网络不卡,应该会很快