Installing RubyGems on Solaris 9

We are using some Ruby on Rails applications at work and I’m impressed with how well they all work so I decided to install it on my private server as well. I’m using Ruby from Sunfreeware but they do not provide a packaged RubyGems. Considering it has its own package management I decided to install it manually.

I followed the installation instructions and executed “sudo ruby setup.rb –prefix=/usr/local” which proceeded to install gems into /usr/local/lib/rubygems. After the installation completed I executed gem in order to see that it had installed correctly but was greeted by:

bash-2.05$ gem
/usr/local/bin/gem:8:in `require': no such file to load -- rubygems (LoadError)
        from /usr/local/bin/gem:8

Which wasn’t quite what I had expected. After some googling I found that in order to get a list of dirs which ruby looks for libraries in you should execute “ruby -e ‘puts $:'” which produced:


As you can see /usr/local/lib is not in this list so I moved rubygems, rubygems.rb, ubygems.rb and rbconfig to /usr/local/lib/ruby/site_ruby/1.8.

After these steps I was able to run gem and I performed a successful install of rake.