- change sources:
gem sources --remove https://rubygems.org/
- 等有反应之后再敲入以下命令
gem sources -a https://ruby.taobao.org/
- 为了验证你的Ruby镜像是并且仅是taobao,可以用以下命令查看:
gem sources -l
- 只有在终端中出现下面文字才表明你上面的命令是成功的:
*** CURRENT SOURCES ***
https://ruby.taobao.org/
- 这时候,你再次在终端中运行:
sudo gem install cocoapods
$ sudo gem install cocoapods
Error
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
解决办法
sudo gem install -n /usr/local/bin cocoapods