There’s a mismatch between the most recent Rails releases (2.1.2 and 2.2RC1) and older versions of RubyGems. Judging by what I’ve seen in various discussion fora, this is well on the way to being a FAQ. It’s made more fun by the facts that
If you’re affected, you’ll see this message when you try to run script/generate in a Rails application:
undefined method empty?' for /_generator$/:Regexp
If you see this, don’t panic. It just means you need a newer RubyGems release. I’m not sure how current you need to be, but 1.1.1 is definitely too old. As I write this, 1.3.0 is current.
Now, in theory, to update to the latest version of RubyGems, you just need to run
sudo gem update --system
But - depending on what version of RubyGems you have installed, running that command may lie and tell you that you have nothing to update. If you’re currently on RubyGems 1.1 or 1.2, you need to run a different set of commands to update RubyGems:
sudo gem install rubygems-update sudo update_rubygems
You can check your current RubyGems version with
gem -v
If it reports 1.3.0 or later, you should be good to use the recent Rails releases.


13 comments
Comments feed for this article
October 25, 2008 at 8:25 am
Hongli Lai
I’m wondering why they don’t just make “gem update –system” run “gem install rubygems-update && update_rubygems”. What is the difference anyway?
October 25, 2008 at 9:37 am
Timothy Caraballo
I have 1.1, and ended up with:
Bulk updating Gem source index for: http://gems.rubyforge.org/
ERROR: could not find rubygems-update locally or in a repository
October 25, 2008 at 1:14 pm
Mike Gunderloy
Timothy: You might try doing a gem update –system first. Dunno if it will help but it won’t hurt. (Thats - - system, two dashes, which WordPress annoyingly changes to a single hyphen)
October 26, 2008 at 10:19 am
Timothy Caraballo
Mike: It did more than not help, It’s fixed! Thanks!
November 4, 2008 at 7:32 pm
Chris Luebcke
Bless you, this post saved my bacon.
November 6, 2008 at 7:59 pm
Mario Zigliotto
Works like a charm, thank you.
November 9, 2008 at 7:55 am
Adrian
Thanks for your hint!
November 14, 2008 at 11:38 pm
deman
bah! all hassle in each upgrade…
November 15, 2008 at 4:18 pm
jeman
This is the clearest explanation of how to handle this error on the net. Thanks for taking the time to do it!
November 17, 2008 at 7:42 pm
Iphan
Thanks for the tip, much appreciated!
November 28, 2008 at 4:49 am
Harry
Thank You, Mike! Helped me out (I had RubyGems 1.2).
December 9, 2008 at 12:10 am
David Rivers
Thank you! I couldn’t find this info. on the RubyGems site!
December 31, 2008 at 3:25 pm
Ben Wagaman
I am current using Ubuntu 8.10. For me, if I ran the commands, rubygems would stay at 1.2 even though it looked like it “updated successfully”
If you are trying to update ruby gems on Ubuntu, you may need to install it manually. Sam Ruby has a good set of instructions. See http://intertwingly.net/blog/2008/11/23/RubyGems-1-3-1-on-Ubuntu-8-10