1、更新gem
sudo gem update --system -n /usr/local/bin
打印遇到error
Updating rubygems-update
Successfully installed rubygems-update-3.0.3
Parsing documentation for rubygems-update-3.0.3
Installing ri documentation for rubygems-update-3.0.3
Installing darkfish documentation for rubygems-update-3.0.3
Done installing documentation for rubygems-update after 52 seconds
Parsing documentation for rubygems-update-3.0.3
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.0.3
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
显示gem 升级成功
gem -v
3.0.3
在安装cocopods时,使用sudo gem install -n /usr/local/bin cocoapods 代替sudo gem install cocoapods --pre
如果遇到WARNING: Unable to pull data from ‘http://ruby.taobao.org/’: bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz) 9 gems installed问题
gem sources --remove http://ruby.taobao.org/
gem sources -a https://gems.ruby-china.com/
最新的方法点击这里https://ruby.taobao.com/
gem sources -a https://gems.ruby-china.com/
查看源对不对
gem sources -l
更换数据源再按照原来安装