« o glorious patterns (of enterprise application architecture) | Main | two firsts »

SOLUTION for "Rails requires RubyGems >= 1.3.1" problem

If you don't care about running Rails 2.2, you can safely ignore this post. If you ran into the same problem I did, this post will help you solve it.
I'm running Aptana Studio 1.2.1 with RadRails 1.0.0, and I'm creating a new Rails project using Rails 2.2.2. The wizard for a new RadRails project seemed to basically work, but it failed on starting the rails server with this error message: "Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again." I tried that several times and it didn't work. Some googling revealed a solution, but the solution isn't quite spelled out in n00b-friendly language. (cwilliams on the aptana support site does the best job yet, though) So here we go.
Prologue: A lecture from your friendly sysadmin. Never run commands that start with "su" if you don't know what they mean.
Body: (much cribbed from cwilliams again)

[ben@pro ~]$ sudo gem update rails   # get the latest version of rails
[ben@pro ~]$ sudo gem update --system # update the RubyGems system software
[ben@pro ~]$ gem install linecache # install the "linecache" gem

linecache is a requirement of RadRails that isn't listed in the requirements.
[ben@pro ~]$ ruby -S gem --version

That tells me that I've got version 1.2.0 of gem installed. Gem is ruby's package manager. So let's install a gem whose purpose is to update the gem system. This is a little complicated, but it works:
[ben@pro ~]$ sudo ruby -S gem install rubygems-update 
Successfully installed rubygems-update-1.3.1
1 gem installed

Good. Now run the script that updates rubygems...

[ben@pro ~]$ sudo ruby -S update_rubygems
Installing RubyGems 1.3.1
mkdir -p /Library/Ruby/Site/1.8
mkdir -p /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin

At the end of the output of the update_rubygems command, you'll see a long message from the RubyGems team. I'm pretty sure you can safely ignore it. Make sure you have the right version of gem installed now:
[ben@pro ~]$ ruby -S gem --version

Good. Now go back to Aptana and start your Rails server again: Window -> Show Views -> Servers. Right-click on the server named <project>Server. Select "Start server in debug mode" from the context menu. The status of the server should switch to "Starting." Right click on the server name again; select "Open Console/Shell." This should show a lovely shell whose output ends with
** Mongrel 1.1.4 available at
** Use CTRL-C to stop.

Don't be frightened that all that text is in red. You're good, you're golden; rails is up and running.

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    openben - shinyblog - SOLUTION for "Rails requires RubyGems >= 1.3.1" problem

Reader Comments (1)

I followed these steps and I am certain that I have gem 1.3.5 is install since after running gem --version yields 1.3.5. However, I am still getting the error that my gem is a lesser version. For some reason radrails thinks my gems version is 1.0.1. Is there a way I can point it to look at the right version?

1.14.2010 at 11:06 AM | Unregistered Commentercody

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>