1.安装xcode
2.Homebrew 安装
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
3.ruby
查看已安装的 ruby
版本
ruby -v
更新
gem update --system
如果报错 Operation not permitted @ rb_sysopen – /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem,则使用: sudo gem update -n /usr/local/bin –system
查看版本
gem -v
替换
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
查看替换后的源
gem sources -l
4.安装CocoaPods
sudo gem install cocoapods
brew install cocoapods
查看已安装 CocoaPods
版本
pod --version
5.CocoaPods
使用问题
pod install
时一直卡在
Cloning spec repo `cocoapods-1` from `https://github.com/CocoaPods/Specs.git`
解决办法参考:Cloning spec repo cocoapods-1
from https://github.com/CocoaPods/Specs.git
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
错误
打开网站 https://www.ipaddress.com/。
网站直接搜索 raw.githubusercontent.com
找出对应的IP。
复制对应的IP到自己电脑的hosts文件里面,快捷键 Command+ Shift+.
显示隐藏文件,快捷键 Command+ Shift+G
找到 /ect/hosts
文件。
用命令行替换方式:vim /etc/hosts
,文件内加入 IP地址 raw.githubusercontent.com
。
Mac下安装CocoaPods
感谢您的来访,获取更多精彩文章请收藏。

THE END