If you have NetBeans 6.0 and you want to use the bundled JRuby, you might as well get 6.0.1 if you want NetBeans to handle updating the JRuby Gems for you (after changing the permissions of the JRuby gems directory of course, see below). NetBeans 6.0 has an OutOfMemory stack problem when trying to update the gems. The latest available Rails for JRuby Gems is 1.2.5 I believe (the bleeding edge as of this date is 2.0.2).

Of course, if you are using OS X’s included Ruby, just go to your command line and update Ruby gems normally (make sure you update rails with all its dependencies). Make sure to also update your environment.rb (in your Rails project configuration) to reflect the version of Rails you will be using.

When installing NetBeans, the whole bundle is installed using user “root” (read, write, execute privileges) and group “admin” (read and execute privileges only). The JRuby package is installed “inside” the NetBeans app bundle, and it has the same permissions. The current “user” needs to have “write” permissions to this JRuby directory, for NetBeans to update the gems:

/Applications/NetBeans/NetBeans 6.0.1.app/Contents/Resources/NetBeans/ruby1/jruby-1.0.2/lib/ruby/gems/1.8

Either that, or you run NetBeans as root. If you want only users from the admin group to have access to this feature of NetBeans, do a “sudo chmod -R g+w <dir>”, or if you want everyone to have this write access, just do a  “sudo chmod -R a+w <dir>” where <dir> is the directory path I referenced above.

Well, if anyone has trouble running NetBeans with Ruby on Rails, tweet me – I might have encountered your problem and solved it already, so I might be able to help.