一、检测gem版本
gem -v
如果gem版本小于2.6.x,则需要更新gem,现在gem版本一般都高于2.6.x。再低的情况也比较少了
如果要是低于小于2.6.x,更新gem指令:
gem update --system
二、将ruby源切换回国内的
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
三、查看是否切换到国内ruby源
gem sources -l
四、更新cocoapods
gem install cocoapods -n /usr/local/bin
报错:ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory
解决方案使用下面的质量就解决了:
sudo gem install -n /usr/local/bin cocoapods --pre
网友评论