You are here

Ruby

Supported Versions

DICE usually has one default version of ruby (as invoked by the ruby, gem, etc.), but on some platforms others will be / can be made available. Here's a summary of normally installed versions:

Version Command Location Notes
DICE Ubuntu Jammy (most desktops, most servers)
3.0 ruby /usr/lib/ruby/ Default version, base libraries plus gem
DICE Ubuntu Focal (some desktops, some servers)
2.7 ruby /usr/lib/ruby/ Default version, base libraries plus gem
DICE SL7 (some older servers)
2.0.0 ruby /usr/share/ruby/ Default version, base libraries plus gem
2.5.0 scl enable rh-ruby25 <...> /opt/rh/rh-ruby25/root/ Must be enabled via SCL to use; includes gem, bundler, rake, rdoc etc.

See our Software Collections page for more general details on SCL availability.

DICE-provided modules

Ruby has a straightforward and powerful mechanism allowing users to install their own modules through the gem system. We'd encourage users to use this wherever possible. For more complex setups we'd recommend the bundler system which enables full sets of library dependencies to be prepared.

However we understand not all modules can be built without assistance and we'll try to provide build dependencies where native compilation is needed.

We'd also ask that you get in touch if your libraries are required for teaching, or where it would be useful for them to be pre-distributed (for example if the build is particularly large or or time-consuming).

Installing modules yourself

In every case we'd recommend use of the gem command. Modern versions should know to install into your home directory using just:

$ gem install packagename

Though if you receive permissions errors attempting to write to system locations (i.e. anywhere not within your home directory), older versions of ruby might require:

$ gem install --user-install packagename

See gem help install for full details on this command.

(SL7-specific): Multiple versions / interactions

Note: This advice should not be required for Ubuntu machines, which run a more modern version.

The gem commands place code into ~/.rvm, ~/.gem and, if ~/bin is in your shell $PATH, executables will be placed there, too. It's worth pointing this out as this spread can make cleanup / uninstallation tricky.

We've seen issues combining multiple versions of ruby concurrently. Where you have ruby 2.0 libraries which you'd like to retain but also need to use/install newer SCL-provided ruby libraries, you may need to clear your Ruby environment variables:

$ unset GEM_HOME; unset GEM_PATH; unset RUBY_VERSION
$ scl enable rh-ruby25 bash
$ gem install <packagename...>

See the documents provided by man ruby (particularly the ENVIRONMENT section) and gem help environment for more details on these interactions.

Last reviewed: 
24/01/2024

System Status

Home dirs (AFS)
Network
Mail
Other services
University services
Scheduled downtime

Choose a topic