I recently created PPAs for Ruby 1.9.1 and Ruby 1.9.2. The default Ruby 1.9.1 package creates binaries in /usr/bin with names like ruby1.9.1, irb1.9.1 etc. However a lot of scripts depend on /usr/bin/ruby and /usr/bin/irb which are provided by Ruby1.8. Hence when I created the PPA for ruby1.9.1, I hardcoded the symlinks – /usr/bin/ruby1.9.2 => /usr/bin/ruby etc.
However Antonio suggested that I should use the update-alternatives system instead. I knew that was the way to go, but didn’t read up about it when I was creating the PPAs and used the symlinks instead. I took his suggestion and updated the Ruby1.9.1 and Ruby1.9.2 packages to support the update-alternatives system. However I soon realized that the Ruby1.8 package still uses hard-coded symlinks. So I ended up updating the Ruby-Defaults package too so that Ruby1.8 would support the update-alternatives system. Ruby1.9.2 has the highest priority and hence will be selected by default. Choose your desired Ruby Version using the following command.
sudo update-alternatives --config ruby
If you have installed rdoc, ri, irb etc, make sure that you update their version too to match the ruby version you are using.
sudo update-alternatives --config rdoc sudo update-alternatives --config irb sudo update-alternatives --config ri
If you are not comfortable with the commandline, you could use the graphical alternatives system configuration tool, kalterantives for kde and galternatives for gnome.
sudo aptitude install galternatives sudo aptitude install kalternatives
Next step is to create a script update-ruby-alternatives like the update-java-alternatives which already exists so that ruby environment can be seamlessly changed between different versions.
I also plan to add the latest ruby-gems package to the PPAs. Soon.
Noticed that the current version installed is 1.9.2dev.
Final has been out for a while and p136 came out on christmas. Will you update the package with the new versions?
Sorry, noticed on your Final blog post entry that the output form ruby -v doesn’t show the patch version. Would be nice if it did though.
Thanks for putting this together!