Is it possible to install precompiled Ruby versions with RVM?

Probably a bit long in the tooth now, but as of 1.16 rvm supports downloading pre-compiled binaries.

I was having difficulty when I asked for the head version (ie 1.9.3)

20130212 00:31:00 dev@domU-xxxx:~ rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.04/i386/ruby-1.9.3-p385.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.

So I looked at what was actually available in pre-built binaries:

20130212 00:31:27 dev@domU-xxxx:~ rvm list remote

# Rubies available for 'ubuntu/12.04/i386':

   ruby-1.9.3-p194
   ruby-1.9.3-p286
   ruby-1.9.3-p327
   ruby-1.9.3-p362
   ruby-1.9.3-p374
   ruby-2.0.0-rc1

And modified my install to ask for the latest precompiled version

20130212 00:34:25 dev@domU-xxxx:~ rvm install 1.9.3-p374
Searching for binary rubies, this might take some time.
ruby-1.9.3-p374 - #configure
ruby-1.9.3-p374 - #download
######################################################################## 100.0%
ruby-1.9.3-p374 - #validate archive
ruby-1.9.3-p374 - #extract
ruby-1.9.3-p374 - #validate binary
ruby-1.9.3-p374 - #setup
Saving wrappers to '/home/dev/.rvm/bin'.
ruby-1.9.3-p374 - #importing default gemsets, this may take time ...
20130212 00:35:59 dev@domU-xxxxx:~

As you can see this took less than 2 minutes to run (as opposed to the 15-20 minutes it takes to compile on an EC2 small instance). Hope this helps someone else with the same problem.


Hmm.. why not create an EBS AMI with RVM and the Ruby versions and launch it anytime you want? Just a thought.:)


If you didn't want to keep using RVM, then maybe you would want to use ruby-enterprise's binary packages? I'm using it not just because it's a lot faster to install, but also because of the horribly done packages in Ubuntu/Debian currently.

So there are binary packages for Ubuntu and I'm sure that beyond the latest version, they also let you download previous version, etc..

Check it out: http://www.rubyenterpriseedition.com/download.html#ubuntu

The only problem is that this will probably not allow you to switch back and forth between ruby installations on the same instance. I'm not sure if that is something you absolutely require.

But other than that, it would be simple to script uninstall and install it either in bash or maybe with a chef recipe. But of course that's not as convenient as rvm.

Edit:

If you can't use the REE .deb, the easiest would be to create an EBS-based AMI and include a rvm install along with your most used ruby versions. That's only one solution to the problem.

Another solution would be to check /etc/rvm (assuming system-wide-install) for rvm_path, rvm_prefix, rvm_bin_path and rvm_man_path and getting those files and downloading them on an instance when you launched it.

This process could be automated with a small shell script that you pass to the EC2 instance (see user-data) when you start it up.

As a general measure, I'd also check into passing custom ./configure flags to rvm when you build additional ruby versions to maybe speed up the compilation. I'm not exactly sure, but I bet you can save them into a .rvm file or similar.

The alternative to above is get a more beefy instance but that may not work out in the long run as the associated costs to run one are also higher.