Saturday, May 14, 2011

RUBYLIB and installing ruby to a custom directory

I needed to install ruby on my uni's lab machine without admin privileges.

To install ruby, I downloaded the version of ruby i needed from http://ftp.ruby-lang.org/pub/ruby/1.8/. And then do the following:


./configure --prefix=/path/to/dir
make
make install


Obviously, you should have read/write privileges to the directory /path/to/dir. Most of the time, it will probably be your home directory.

After much searching and tweaking later on, I also found that you have to set the RUBYLIB environment variable.

Assuming you're using Linux and bash, you do the following:


export RUBYLIB=/path/to/dir


What if you have a different installation of ruby, say the standard one on the same machine? Good question. I don't know the answer. :) If you do, please leave it in the comments.

No comments: