$GEM_HOME makes ruby programming even better

Ruby is by far one of my favourite programming languages. It combines the power of Perl with the flexibility of Lisp while remaining far more readable than either.

The downside of this though is that a great deal of Ruby development is done in conjunction with the Gem package manager. At best you are asked for the root password and the the /usr directory gets polluted by packages that aren’t part of your distribution and potentially changes behaviour for other users on the system.

The simple solution to this is to add the following into your profile script:

if which ruby >/dev/null && which gem >/dev/null; then
export GEM_HOME=$(ruby -rubygems -e ‘puts Gem.user_dir’)
export PATH=$GEM_HOME/bin:$PATH