1

I posted this question before but I had 11.04 which is not supprted. So now I updated to 11.10, but still the problem is not solved.
I want to use ruby 1.9.1 . The problem I am facing is shown below. I wish someone could help me out.

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"

$ sudo apt-get install ruby1.9.1-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
ruby1.9.1-full is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.

$ update-alternatives --config ruby
update-alternatives: error: no alternatives for ruby.

$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]

$ which ruby1.9.1
/usr/bin/ruby1.9.1

2 Answers 2

2

You might find rvm helpful. Rvm is a command line program that allows you to manage multiple versions of ruby. If you are interested, you can read more about it here.

If you just want to get rid of Ruby 1.8.1, run the following command: sudo apt-get remove ruby1.8

0
1

Aaron is correct, I am adding this answer to elaborate a bit and provide more details.

This is a huge thing in Rails land, and big (though not as bad) in ruby land.

The system version of ruby must be 1.8 or some installed applications will fail. There are quite a few UI applications that use ruby. However 1.9 is the new way to go, so you more then likely would want to use it on new projects (be they rails or pure ruby).

If your developing an application Ruby Version Manager should meet your needs. You can download and install it from this site. BUT if your trying to use 1.9 that was packaged for/with Ubuntu, RVM WILL NOT WORK

RVM only loads in your environment. Usually only in your command line environment (though this doesn't have to be true). It compiles ruby from source and does not use packaged versions. Again this is the accepted way to use ruby for development, not as a user or consumer, or in production.

If an app you want to run requires ruby, you should be able to give it a ruby path. If the app in question is built for Ubuntu then installing that app should be all you need.

If your working with rails

Do not use the system ruby or the packaged rails gems. They are totally and completely wrong for development. Instead use RVM + bundler + gemsets to manage your setup. On production boxes you would normally use just bundler.

If your working with ruby

Do not use the system ruby or packaged gems. rvm + gemsets are the accepted way to build new projects. In production this gets more complicated depending on targets.

If your deploying Ruby Apps

Then you need to make sure you run your test suite on the individual system versions that you are aware of. In ruby patch level is important and you need to make sure you code works, or is deployed with, a working ruby.

Shameless plug

Instructions for compiling a working ruby from source can be found on my website. Note that it's for production servers, and intended to be used in rails environments. But it should get you started if you decide to compile.

TL;DR;

  • RVM + gemsets = developing ruby applications
  • RVM + bundler + gemsets = developing rails applications
  • bundler (and a complied specific version of ruby) = production rails applications
  • system ruby + lots of testing = production ruby applications

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .