Setting up Solaris Express for Using Ruby on Rails with Native Ruby and NetBeans

Solaris Express Developer Edition (SXDE) 01/08 comes with both a native Ruby implementation and NetBeans 6.0 preinstalled.

This howto describes some initial configuration steps you need to make to have a smooth experience using native Ruby with NetBeans in SXDE 01/08.


If you want to use native Ruby rather than the JRuby that comes with NetBeans, then you need to tell NetBeans where the gem repository is. You do this by setting the GEM_HOME environment variable and then starting up NetBeans within that environment.

The easiest way to do this is to write a little script that sets GEM_HOME and then starts NetBeans, and then modify your NetBeans shortcut to run this script.

  • Write the script. For the purposes of this document, let's say you put it in ~/bin/netbeans
export GEM_HOME=/var/ruby/1.8/gem_repository

Don't forget to do
chmod +x ~/bin/netbeans
to make your new script executable.
  • Fix your shell config file (e.g.
    or {.profile} to set GEM_HOME.
  • Fix your NetBeans shortcut. I found the best way to do this is to drag the NetBeans icon from
    All Applications->Developer Tools
    to your system tray. Then right-click, choose Properties, and modify the command to be {bin/netbeans}.

Alternately, if you don't want to bother with changing your shortcut, you can just run your script from the command-line.

Set up your Gem Repository and Install Rails

Use the attached script

After doing these a number of times, I realized that they are quite easy to automate. To make your life easier, I have attached the script to do this, you will find it at the bottom of this page.

What follows are the manual instructions and background information for setting up the gem repository and installing Rails.

Fix Permissions

Because both Ruby and NetBeans are installed as root, they are not writeable by anyone else as root. Unless you want to run as root (not recommended), you need to fix permissions. Just follow these steps. Note that you only want to do this if you own this machine and are not sharing it with others. If you are sharing this machine with multiple users, you will probably want to set up an independent repository for each user. This document has a good description of how to do that.

$ su
# chmod -R a+w /var/ruby/1.8/gem_home
# chmod -R a+w /opt/netbeans-6.0/ruby1/jruby-1.0.2/lib/ruby/gems
# chmod -R a+w /usr/ruby/1.8/bin

Note you also need to make Ruby's bin directory writable. I'm not sure why this is, but installation of Rails fails unless you do this.

Install Ruby on Rails

The native Ruby support that comes with SXDE 01/08 does not include Rails. It is easy enough to install however.

Note that NetBeans 6.0 has some issues with Rails 2.x, although you can get it to work, see the NetBeans Tutorial Divas blog on how to do this. However, for best results, I recommend using the same version that comes with JRuby support in NetBeans, which is version 1.2.5.

$ gem install rails --version 1.2.5

This assumes GEM_HOME is set in your enviornment...

It will ask you if you want to install all dependencies, just keep saying "yes." I tried to use the
option but it failed saying the gem rails (version 1.2.5) could not be found... To get the latest version of Rails rather than version 1.2.5, just do
gem install rails
with no version specified.

Installing Rails using the NetBeans Gem Install Tool

You can also install Rails directly in NetBeans, once you have set up your GEM_HOME correctly.

You will be prompted to install Rails the first time you create a Rails project. However, with this approach, NetBeans automatically installs the latest version of Rails, which is not what I recommend.

So, a better approach is to go to
Tools->Ruby Gems
, and select the {Available} tab, and search for "Rails". Then click Install and choose "1.2.5" from the version drop-down, or choose the latest version if you want to go with 2.x.


Set NetBeans to use native Ruby

This is pretty simple. Bring up NetBeans, and create a new Ruby On Rails project (File->New Project->Rails->Ruby on Rails Application). The first panel of the project wizard will ask you if you want to use JRuby or native Ruby (under /usr/ruby/1.8/bin). Pick native Ruby, and you're good to go.

At this point you should be able to walk through the Ruby Tutorial without a hitch (you will need to start up MySQL, which is described in this howto).


This is a Wiki page, which is meant to be collaborative. If you have more information that you think is useful, or corrections and errata, please feel free to add your comments here.

CORRECTION: I think you want to set
not {/var/ruby/1.8/gem_repository} like you have in the script at the top of the page. This path doesn't exist on my SXDE 01/08 image and causes gem to crash noisily. COMMENT: You can start the Netbeans php ide (which has less modules and presumely a smaller RAM footprint) by substituting
for {/opt/netbeans-6.0/bin/netbeans} in the startup script at the top of the page.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo