gem和boundle安装在国内被墙,淘宝提供了淘宝提供了RubyGems的国内镜像站点,解决办法是:
对于gem:
$ gem sources --remove https://rubygems.org/
$ gem sources -a http://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES *** http://ruby.taobao.org
# 请确保只有 ruby.taobao.org
$ gem install rails
对于boundle:
修改Gemfile文件,将默认的
source 'http://rubygems.org'
改成
source 'http://ruby.taobao.org/'
解决 bad response Not Found 404 (http://ruby.taobao.org/latest_specs.4.8.gz)
原因:淘宝停止基于 HTTP 协议的镜像服务 需要改用https的协议
fix步骤:
gem sources --remove http://ruby.taobao.org/ gem sources -a https://ruby.taobao.org/ gem sources -l sudo gem install cocoapods