总共就下面几个命令行
sudo gem update --system
gem sources --remove https://rubygems.or
gem source -a https://gems.ruby-china.org/
sudo gem install -n /usr/local/bin cocoapods
pod setup
pod --version
pod search AFNetWorking
升级Ruby环境
gem update --system
若报错
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
则把上面的命令行换成
sudo gem update --system
更换Ruby镜像
// 检查现有 Ruby镜像
gem sources -l
如果结果是
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
就不需要替换了,否则就要替换,执行下面命令
// 移除现有镜像
gem sources --remove https://rubygems.or
// 添加国内镜像
gem source -a https://gems.ruby-china.org/
// 检查是否替换成功
gem sources -l
安装 Cocoapods
sudo gem install cocoapods
若出现
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
则换成下面的命令行
sudo gem install -n /usr/local/bin cocoapods
建立索引库
pod setup
查看版本
pod --version
原文地址:https://www.cnblogs.com/shidaying/p/8338089.html
时间: 2024-10-15 11:36:03