While executing gem ...

       执行:  gem install cocoapods --pre 命令时出现错误如下: 
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
      Unable to download data from http://rubygems-china.oss.aliyuncs.com - bad response Forbidden 403 (http://rubygems-china.oss.aliyuncs.com/specs.4.8.gz)

  https://gems.ruby-china.com
 
 切换镜像源:gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/

再次升级 cocospod时: gem update --system

提示没有权限:
屏幕快照 2019-05-05 上午11.47.35.png
然后输出  sudo gem update --system
还是提示没有权限:
屏幕快照 2019-05-05 上午11.49.53.png
然后尝试:sudo gem install cocoapods -n /usr/local/bin
问题解决:
屏幕快照 2019-05-05 上午11.51.04.png

你可能感兴趣的:(While executing gem ...)