Due to the domestic network environment, the resource files stored on Amazon S3 by RubyGems.org intermittently failed to connect, so the use of gems or bundles often encountered a long period of no response.
The solution is to use Taobao’s RubyGems mirror, which is a full RubyGems.org image that you can use in place of the official version, which is currently synchronized every 15 minutes to ensure maximum synchronization with the official service.
How to use
gem
Remove the old source and replace it with the new one.
$ gem sources --remove https://rubygems.org/ $ gem sources -a http://ruby.taobao.org/ $ gem sources -l *** CURRENT Sources *** http://ruby.taobao.org # Please make sure only ruby.taobao.org $gem install the gem you want to install
Bundle
The source 'http://ruby.taobao.org/' gem 'rails',' 4.0.2 '...
Ruby source image
As a bonus, Taobao also provides Ruby source code download images to improve the speed of Ruby installation in China.
For example, using RVM, you can use Taobao as the download source:
$ sed -i 's! cache.ruby-lang.org/pub/ruby! ruby.taobao.org/mirrors/ruby! ' $rvm_path/config/db
A link to the
- Project home page
- Feedback problems
Compiling SegmentFault