Installing Ruby Gems in your home directory

I’ve been playing with Ruby in my cheap shared hosting provider. They don’t include everything I need so I had to install Ruby Gems in my home directory. The instructions don’t work. So here’s what I did…

First set up environment variables to tell Ruby and Gems where to find stuff:

export GEM_HOME=$HOME/lib/ruby/gems/1.8
export RUBYLIB=$HOME/lib/ruby:/home/ian/lib/site_ruby/1.8

Download and unpack the Gems source (this is the version I downloaded, you should grab the latest:

wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz
tar xzvf rubygems-0.9.4.tgz
cd rubygems-0.9.4

Run the setup.rb script with the right arguments to install into your home directory:

ruby setup.rb all --prefix=$HOME --siterubyver=$HOME/lib/site_ruby/1.8

This will install the gem command (and a couple of others) into $HOME/bin and the Gems source into $HOME/lib/site_ruby. Gems will be installed into $HOME/lib/ruby/gems/1.8. You should add $HOME/bin to your path. If you want to install it somewhere else replace $HOME with the prefix you’d like to use.

This entry was posted in Default and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Posted August 29, 2007 at 8:55 pm | Permalink

    FIX YOUR TECHNORATI BOX IN FIX YOUR TECHNORATI BOX IN YOUR RSS FEED STOP BREAKS SYNDICATION STOP VERY FRUSTRATING STOP

  2. Ian McKellar
    Posted August 30, 2007 at 2:01 pm | Permalink

    bah, aggregators should use bah, aggregators should use tidy

  3. Posted January 27, 2009 at 4:35 pm | Permalink

    Great article, it answered several questions I’ve had for a while. Please continue posting these. :) Regards, Mike

One Trackback

  1. By Installing Merb in Your Home Directory on April 30, 2008 at 8:03 pm

    [...] to Ian Mckellar for starting me [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Subscribe without commenting