How to skip gem documents (ri, rdoc) installation

on No Rdoc, No Ri, Skip Documents With Bundler, Skip Gem Document

By default, RubyGems will install documents (ri, rdoc) together with gem when you install gem. It happens for both gem install and installing with bundler.
Almost ruby developers will want to skip documents installation because they are usually useless with us and it takes time to install, specially when we use separated gemset for each project.

  1. With single gem installation
    When installing single gem with gem install, we can add --no-rdoc --no-ri options to skip documents installation. So, command to install a gem will be: gem install rails --no-rdoc --no-ri

  2. By default and make bundler skip documents too
    Above method is long, repeated everytimes we install a gem and bundler doesn't have these options to skip documents. I also beleive that almost ruby developers are using bundler to install gems.
    To resolve this inconvenience, we can set these options as default when install gems by adding: gem: --no-rdoc --no-ri to ~/.gemrc (recommended) or /etc/gemrc. From now, both single gem installation and bundler will skip documents without adding anythings to installation command

A full stack developer with Ruby on Rails as the main framework. Eager to learn and share.