Using RubyGems at SDF

NOTE: Consider requesting system-wide installation of gems that others may find useful, instead of installing local copies for yourself. The usual way of making such requests is to post on the REQUESTS bboard. For a brief introduction to bboard, go here.

RubyGems is a package manager for the Ruby programming language.

Since you're most likely a non-privileged SDF user, you cannot install gems the traditional way. This is due to the fact that “gem install GEMNAME” tries to bulk update its cache of available gems at gems.rubyforge.org which will exceed your RAM quota. You should thus setup the 'gem' command to install gems locally:

  • Make a directory for gem installation:
    • $ mkdir ~/.gems
  • Set up your .gemrc:
    • $ cat << EOF > ~/.gemrc
    • gem: –no-ri –no-rdoc –local # Local install, but don't generate documentation
    • gemhome: $HOME/.gems
    • gempath:
      • $HOME/.gems
      • /usr/pkg/lib/ruby/gems/1.8
  • Set up some environment variables for run-time:
    • $ cat << EOF >> ~/.profile
    • export GEM_HOME=$HOME/.gems
    • export GEM_PATH=$HOME/.gems:/usr/pkg/lib/ruby/gems/1.8
    • export PATH=$PATH:$HOME/.gems/bin

At this point, you can start downloading gems and then install them. Note that you have to resolve their dependencies yourself. If you need help, “gem help install” and the online documentation are your friends.