Want to stay on top? Ruby Weekly is a once-weekly e-mail newsletter covering the latest Ruby and Rails news.
     Feed Icon

How to Significantly Speed Up Gem Installation

By Peter Cooper / March 4, 2009

speed.png

Brian 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 have a significant effect nonetheless.

Brian demonstrates that you can try it on an ad-hoc basis by adding --no-ri --no-rdoc to your gem install lines, or you can add gem: --no-ri --no-rdoc to your ~/.gemrc file.

Sometimes it's the smaller, throwaway tips that can really brighten your day. Got any time-saving .irbrc or .gemrc tips to share?If we get enough, we could run a post full of them.

Comments

  1. Jerry Cheung says:

    I just learned this same tip about a week earlier from our operations guy. In a similar vein, pulling down gem docs and running 'gem server' locally can be a good productivity boost for development.

    http://whatcodecraves.com/articles/2009/02/28/rails_and_gems_documentation_anywhere

  2. Erik says:

    The only problem I've found with this idea is that you then have no RDocs locally for your gem. Most of the time, not a big deal. However, in the case of the 800lb gorilla, Rails, if you don't have the RDoc for your older versions, you can be lost when trying to code for your old site/program that uses an older API. I have run into this problem even just going from Rails 2.1 to 2.2. I was trying to do something with an ActiveRecord object and found a great option for has_many in the online RDoc...urg, why doesn't it work...oh, it was introduced in 2.2 and I'm on 2.1.

  3. Bruce Williams says:

    This is especially useful on automated server installations (eg, with Chef), when you don't really need the documentation and would like to bootstrap a system quickly.

  4. iain says:

    I use the tricks for .irbrc posted recently by thoughbot: http://giantrobots.thoughtbot.com/2008/12/23/script-console-tips

    I had syntax highlight in irb for a long time, but the logger in ./script/console was very useful addition!

  5. Ben Schwarz says:

    Its worth noting that Sprinkle does this out of the box, you can also re-enable rdoc and ri installation if you so wish to.

  6. szeryf says:

    Erik, try http://apidock.com/rails, they have docs for Rails since version 1.0.0.

  7. pete says:

    @Erik: same thing as szeryf, but I prefer Rails Brain.

  8. cldwalker says:

    A common irb 'trick' I use is reloading a file I've required: http://github.com/cldwalker/my_core/blob/36a995109fbf8ab58cb5f6a17ce9d98071d60f57/lib/my_core/object.rb#L20-23

    For example: If I want to reload a required path 'hirb/display', then I reload it with: irb>> reload 'hirb/display'

    My irbrc files are at http://github.com/cldwalker/irbfiles/tree/master

  9. Matías says:

    No documentation.

  10. Joshua Sierles says:

    Another great way to speed up gem installs is to setup an internal gem mirror. It's dead simple: only requires a web virtual host and the gem command. This has an added benefit of allowing you to stage your own gems or add gems from other servers. Try your luck with the 'gem mirror' command, or use the following simpler method:

    http://rubyforge.org/docman/view.php/5/231/mirror_setup.html

    Also see our Chef recipe for creating a mirror: http://tinyurl.com/bj6ubl

Other Posts to Enjoy

Twitter Mentions