Skipping gem documentation: configure .gemrc to speed up gem installation

Posted by nick.stielau on December 06, 2009

The .gemrc file can specify default options for the 'gem' executable, and since I haven't ever looked up ri or rdoc on my local system, I decided to turn these off by default. I've been adding the '--no-ri' and '--no-rdoc' flags for a while, but my laziness just got the better of me.

Turning of the RI and Rdoc documentation speeds up gem installs. Here, installing capistrano without docs takes about 11 seconds, whereas installing the documenation more than doubles the time to about 24 seconds.

CODE:
  1. nicks-computer-3:snap nick$ time sudo gem install capistrano --no-ri --no-rdoc
  2. Successfully installed capistrano-2.5.10
  3. 1 gem installed
  4.  
  5. real    0m11.480s
  6. user    0m7.262s
  7. sys 0m0.374s
  8. nicks-computer-3:snap nick$ time sudo gem install capistrano --ri --rdoc
  9. Successfully installed capistrano-2.5.10
  10. 1 gem installed
  11. Installing ri documentation for capistrano-2.5.10...
  12. Installing RDoc documentation for capistrano-2.5.10...
  13.  
  14. real    0m23.974s
  15. user    0m18.956s
  16. sys 0m0.706s

If you want to turn off the documentation options, add this line to your ~/.gemrc file:

CODE:
  1. gem: --no-ri --no-rdoc

So that it looks something like this:

CODE:
  1. nicks-computer-3:snap nick$ cat ~/.gemrc
  2. ---
  3. :bulk_threshold: 1000
  4. :backtrace: false
  5. gemcutter_key: XXXXX
  6. gem: --no-ri --no-rdoc
  7. :benchmark: false
  8. :verbose: true
  9. :update_sources: true
  10. :sources:
  11. - http://gems.rubyforge.org/
  12. - http://gems.opscode.com

Comments

Leave a response

Comments