How to make –no-ri –no-rdoc the default for gem install? – Dev

The best answers to the question “How to make –no-ri –no-rdoc the default for gem install?” in the category Dev.


I don’t use the RI or RDoc output from the gems I install in my machine or in the servers I handle (I use other means of documentation).

Every gem I install installs RI and RDoc documentation by default, because I forget to set --no-ri --no-rdoc.

Is there a way to make those two flags the default?


From RVM’s documentation:

Just add this line to your ~/.gemrc or /etc/gemrc:

gem: --no-document

Note: The original answer was:

install: --no-rdoc --no-ri 
update: --no-rdoc --no-ri 

This is no longer valid; the RVM docs have since been updated, thus the current answer to only include the gem directive is the correct one.


You just add the following line to your local ~/.gemrc file (it is in your home folder):

gem: --no-document


echo 'gem: --no-document' >> ~/.gemrc

or you can add this line to the global gemrc config file.

Here is how to find it (in Linux):

strace gem source 2>&1 | grep gemrc

The --no-document option is documented in the RubyGems CLI Reference.


On Linux (and probably Mac):

echo 'gem: --no-document' >> ~/.gemrc

This one-liner used to be in comments here, but somehow disappeared.


Note that --no-ri and --no-rdoc have been deprecated according to the new guides. The recommended way is to use --no-document in ~/.gemrc or /etc/gemrc.

install: --no-document
update: --no-document


gem: --no-document