cocoapods安装 Unable to download data from http://ruby.taobao.org/ & don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
安装cocoapods,记录两个问题!
1、镜像已经替换成了 http://ruby.taobao.org/, 还是不能不能安装cocoapods, 报错:Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/latest_specs.4.8.gz)
如图:
原来是ruby.taobao.org已经停止基于 HTTP 协议的镜像服务, 启用 HTTPS 协议代替。
解决办法,输入:
gem sources --add https://ruby.taobao.org/ --remove http://ruby.taobao.org/
回车,然后如图所示:
2、第一个问题结束后,还不能安装,没有写入权限:You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
如图:
解决办法,输入:
sudo gem install -n /usr/local/bin cocoapods
回车,ok, 能安装了:
原文链接:http://www.cnblogs.com/tandaxia/p/5612259.html
------ ------- 2017 update ---------
最新ruby镜像更新地址:http://gems.ruby-china.org/
安装步骤:
1、更新ruby最新版本
sudo gem update --system
2、更新镜像源,默认是:https://rubygems.org/, 更换为:https://gems.ruby-china.org/
gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
3、安装cocoapods 命令行
sudo gem install -n /usr/local/bin cocoapods --pre
就OK了 !
部分截图:
------ ------- 2019 update ---------
淘宝镜像又更改了
gem sources -add https://gems.ruby-china.com/ --remove https://rubygems.org/