If you want to install Gems inside China, unfortunately, you can’t use the default Rubygems.org website, as you receive a reset:
$ gem install rails AutoShare-Gallery/git/master ! ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/rails-4.2.4.gemspec.rz)
The Chinese company Taobao provides an up-to-date mirror (15min), that you can use. If you only want to use that mirror for one Gem installation, just use
-s, replacing rails
gem install --clear-sources -s https://ruby.taobao.org rails
If you plan, on staying longer in China, it might be useful to replace the RubyGems server for the moment:
gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
Conveniently, bundler has a feature to alias a Gem-server to another one. This way, you can leave your Gemfile
source 'https://rubygems.org' at the top of each Gemfile.
Run this command:
bundle config mirror.https://rubygems.org https://ruby.taobao.org
To remove the aliasing, just delete the appropriate line in
On the Taobao Gem-Server there is also some information on how to handle RVM / Ruby installations.