Make Ruby 1.9.1 default on Ubuntu 9.10 Karmic Koala

Blog calendar

RSS feed from Michal Frackowiak's blog

subscribe to the RSS feed

— or —

get my blog posts via email

Arotaritei VladArotaritei Vlad
TRT- Vipul SharmaTRT- Vipul Sharma
Matt GentileMatt Gentile
Renew SSLSRenew SSLS
Sven StettnerSven Stettner
Joshua DarbyJoshua Darby
lil g easylil g easy
Mr ShaggyMr Shaggy
Chen XXChen XX
Super Dr GreenSuper Dr Green

... and more

Watch: site | category | page

Blog tags

« Back to the Blog

16 Dec 2009 09:26

Ubuntu Karmic Koala comes with Ruby 1.9.1 — at last. But default Ruby version is still 1.8.7, which means that ruby and irb will still link to 1.8.7, and the bright and shiny 1.9.1 will be available as ruby1.9.1 and irb1.9.1.

If you want ruby and irb to link to 1.9.1 version, look at the following piece of code that change the default ruby version. Applying this to a plain and fresh Ubuntu 9.10 Karmic Koala gives you full Ruby installation:

aptitude -y update
aptitude -y install ruby1.9.1 ruby1.9.1-dev \
        rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 g++

# If you already have 1.8 installed
update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.8 500 \
        --slave   /usr/share/man/man1/ruby.1.gz ruby.1.gz \
            /usr/share/man/man1/ruby.1.8.gz \
        --slave   /usr/bin/ri ri /usr/bin/ri1.8 \
        --slave   /usr/bin/irb irb /usr/bin/irb1.8 \
        --slave   /usr/bin/rdoc rdoc /usr/bin/rdoc1.8

# Install ruby1.9.1
update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
         --slave   /usr/share/man/man1/ruby.1.gz ruby.1.gz \
                                   /usr/share/man/man1/ruby1.9.1.1.gz \
        --slave   /usr/bin/ri ri /usr/bin/ri1.9.1 \
         --slave   /usr/bin/irb irb /usr/bin/irb1.9.1 \
        --slave   /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1

# choose your interpreter
# changes symlinks for /usr/bin/ruby ,
# /usr/bin/irb, /usr/bin/ri and man (1) ruby
update-alternatives --config ruby

# now try
ruby --version

I am also installing g++ and ruby1.9.1-dev packages because some of gems need those.

BTW: is now the default gem source, out of the box.

Good luck!

rating: 0, tags: ruby ruby1.9 ubuntu

rating: 0+x


Add a New Comment