How to speed up gem installs 10x

Answer: Turn off ri and rdoc installation. Sure, you can do this on the commandline, like so:

sudo gem install fastercsv --no-ri --no-rdoc

Better, though, is to set this up as the default in your ~/.gemrc file.

---
:verbose: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com/
:update_sources: true
:backtrace: false
:bulk_threshold: 1000
:benchmark: false
gem: --no-ri --no-rdoc

Just add that last line and your gem installations will complete in no time.

Posted in ruby. 22 Comments »

22 Responses to “How to speed up gem installs 10x”

  1. Joe Grossberg Says:

    I’ve heard this tip before and noticed that it makes a huge difference.

    But why are they so slow? Don’t ri and rdoc essentially just read in some Ruby files and then output a small amount of text?

  2. grosser Says:

    Thanks for the tip, ive been using gemi as alias for sudo gem install –no-ri –nor-rdoc, but when installing my own gems via rake install this did not work .

  3. Salman Ansari Says:

    Awesome. Was getting really tired of constantly adding these options every time.

  4. meekish Says:

    Since gem installs also require sudo, I just threw this into my ~/.bashrc to take care of it all with one alias:

    alias gemi=”sudo gem install –no-ri –no-rdoc”

    then I can simply do:

    gemi hpricot

  5. iain Says:

    But, but, but… I like my local rdoc’s!

    I autostart gem server whenever I boot my pc!

  6. Phil Says:

    No rdoc I can understand, but no ri is a bit crazy. Why should you need to use a browser to look up methods? What if you’re offline?

  7. iain Says:

    I don’t mind waiting a bit when it installs, as long as I have as much info as I can offline.

    having rdoc is handy, because it also contains the source code of the gem.

    imo speeding up gem install is a bit of a non-issue.

  8. Speed Up Gem Installs Significantly Says:

    [...] Dainton, a developer at FiveRuns, demonstrates “how to speed up gem installs 10x.” I don’t buy that it’s ten times faster, but disabling the generation of ri and rdoc documents does [...]

  9. Bruce Williams Says:

    Iain, certainly you don’t need the documentation on a production server, and when you need to replace a production server quickly, things like this really do matter.

  10. Bruce Williams Says:

    Piggy-backing off the last comment — keep in mind there are two completely different environments to deal with. Sure, in development you want docs. But in production, why?

  11. iain Says:

    That is certainly true. Although I try to include as much gems in my project as possible anyway.

  12. Como fazer uma instalação de gem significantemente rápida Says:

    [...] Dainton, um desenvolvedor da FiveRuns, demonstra “como instalar um gem 10x mais rápido”. Eu não creio que seja 10 vezes mais rápido,  mas desabilitando a geração dos documentos de [...]

  13. Instalando gems mais rapidamente « Pequenas idéias, grandes soluções. Says:

    [...] original por Brian Danton, desenvolvedor da FiveRuns, aqui, e comentários no Ruby Inside, por Peter Cooper, [...]

  14. Mike Rosset Says:

    I believe -d has the same effect

  15. a work on process » Selected Saturday Links Says:

    [...] How to speed up gem installs 10x « The Budding Rubyist [...]

  16. James Says:

    Wow, that’s what we always do on production server.

  17. Andrew Grimm Says:

    Is there a way to install the gems in haste and then install documentation at leisure?

  18. Andrew Grimm Says:

    It turns out you can install the documentation at leisure using gem rdoc, as mentioned in this stack overflow question.

  19. Awef Says:

    Perhaps on solaris this could make a huge diff. I’ve had major problems installing gems in a timely fashion on a solaris 10 box on a t1000… to my recollection in large part due to rdoc.

  20. tink! » Blog Archive » Configurand Rails no Mac Says:

    [...] Como já era de se esperar, o RubyGems também já vem configurado. Note que que utilizei –no-ri e –no-rdoc, excluindo o download da documentação. Assim, a gem pode ser instalada até 10x mais rápida. [...]

  21. a work on process » Selected (belated, extended) Saturday Links Says:

    [...] How to speed up gem installs 10x « The Budding Rubyist [...]

  22. almost effortless » Weekly Digest, 6-22-09 Says:

    [...] Digest, 6-22-09 Posted by Weekly Digest in Weekly Digest on June 22, 2009 0 Comments How to speed up gem installs 10x Answer: Turn off ri and rdoc [...]


Leave a Reply