$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

By Ryan McCoskrie

I am a nerd trapped in the country side of North Canterbury, New Zealand trying to get an IT-related career off of the ground. Legal disclaimer: Ryan McCoskrie is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com I'm also signed up with Fishpond but they aren't as strict about this stuff.

Leave a comment