make rvm work (for you) with dependencies

Posted: May 15, 2011 in Uncategorized

I love the idea of RVM – the ruby version manager. If you need more than one version of ruby – or different sets of rubygems – on the same system, then RVM certainly is for you!

It let’s you install multiple (what feels to be an infinate number of) versions of ruby to work with. Also it allows you to strictly seperate the gems of each version.
Why is this important? Well let’s assume, you have 2 projects. One of which is a rather old project, that you started a few years ago and that is running fine as is, which might be ruby 1.8.7 and rails 2.3.
And on the other hand you have a brand new project you are just starting out on. Of course you want to use the latest and greatest, which as of right now might be ruby 1.9.2 and rails 3.1-pre. To combine those two on one machine was virtually impossible before. But now there’s RVM and gives you the possibility to run them along-side of each other.

However, there are some pitfalls when switching to RVM as partly described at https://rvm.beginrescueend.com.

The first thing I discovered was the lack of irb. :-( Irb is the command-line interface used by ruby. Also the rails-console requires irb and readline (mostly for tab-completion I assume). It’s as easy as this:

no realine = no rails console!

So you have to install readline somehow. Unfortunately, you have to uninstall your ruby version and reinstall it after installing readline.

To install readline run:

# note: rvm package is now "rvm pkg"
rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr

There is quite a few more features, that one might want when using ruby. So this is the string I used to install my version of 1.9.2 for future reference:

rvm install 1.9.2 --with-iconv-dir=$rvm_path/usr --with-readline-dir=$rvm_path/usr --with-zlib-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-curl-dir=$rvm_path/usr

This should do the trick – at least it looks good so far. ;)

A quick update: I’ve had more problems with RVM. This time, the installation of curl, that rvm compiles did not have SSL-support. To (re-)compile it yourself with ssl, run (in ~/.rvm/src/curl.X.X):

./configure –with-ssl
make
make install

This solved a few of my problem – unfortunately not all. :-(

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s