For Debian squeeze (6.0):
First make sure to uninstall all ruby and ruby1.8 packages. Otherwise they will interfere with the binaries/links that are about to be set up for ruby 1.9.
Then install the ruby 1.9 packages. Despite the fact that these packages are named '1.9.1' they actually install ruby version 1.9.2 on Debian squeeze. The virtual package ruby1.9.1-full
will install all the packages necessary for ruby:
sudo aptitude install ruby1.9.1-full
Add alternative links for ri and manpage in the ri1.9.1 package. (These two lines are all one command.)
sudo update-alternatives --install /usr/bin/ri ri /usr/bin/ri1.9.1 10 \
--slave /usr/share/man/man1/ri.1.gz ri.1.gz /usr/share/man/man1/ri1.9.1.1.gz
Add alternative links for ruby, associated binaries, and manpages in the ruby1.9.1 package. (These lines are all one command.)
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 10 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz /usr/share/man/man1/ruby1.9.1.1.gz \
--slave /usr/bin/erb erb /usr/bin/erb1.9.1 \
--slave /usr/bin/gem gem /usr/bin/gem1.9.1 \
--slave /usr/bin/irb irb /usr/bin/irb1.9.1 \
--slave /usr/bin/rake rake /usr/bin/rake1.9.1 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1 \
--slave /usr/bin/testrb testrb /usr/bin/testrb1.9.1 \
--slave /usr/share/man/man1/erb.1.gz erb.1.gz /usr/share/man/man1/erb1.9.1.1.gz \
--slave /usr/share/man/man1/gem.1.gz gem.1.gz /usr/share/man/man1/gem1.9.1.1.gz \
--slave /usr/share/man/man1/irb.1.gz irb.1.gz /usr/share/man/man1/irb1.9.1.1.gz \
--slave /usr/share/man/man1/rake.1.gz rake.1.gz /usr/share/man/man1/rake1.9.1.1.gz \
--slave /usr/share/man/man1/rdoc.1.gz rdoc.1.gz /usr/share/man/man1/rdoc1.9.1.1.gz \
--slave /usr/share/man/man1/testrb.1.gz testrb.1.gz /usr/share/man/man1/testrb1.9.1.1.gz
Note that these are all installed at a low alternative priority of 10 (the last portion after the --install
flag but before the --slave
flags). This is done in the hope that future versions of Debian will include both ruby 1.8 and ruby 1.9 as part of the alternatives system and override these links.
Check ri in the alternatives system:
update-alternatives --display ri
The result:
ri - auto mode
link currently points to /usr/bin/ri1.9.1
/usr/bin/ri1.9.1 - priority 10
slave ri.1.gz: /usr/share/man/man1/ri1.9.1.1.gz
Current 'best' version is '/usr/bin/ri1.9.1'.
Check ruby in the alternatives system:
update-alternatives --display ruby
The result:
ruby - auto mode
link currently points to /usr/bin/ruby1.9.1
/usr/bin/ruby1.9.1 - priority 10
slave erb: /usr/bin/erb1.9.1
slave erb.1.gz: /usr/share/man/man1/erb1.9.1.1.gz
slave gem: /usr/bin/gem1.9.1
slave gem.1.gz: /usr/share/man/man1/gem1.9.1.1.gz
slave irb: /usr/bin/irb1.9.1
slave irb.1.gz: /usr/share/man/man1/irb1.9.1.1.gz
slave rake: /usr/bin/rake1.9.1
slave rake.1.gz: /usr/share/man/man1/rake1.9.1.1.gz
slave rdoc: /usr/bin/rdoc1.9.1
slave rdoc.1.gz: /usr/share/man/man1/rdoc1.9.1.1.gz
slave ruby.1.gz: /usr/share/man/man1/ruby1.9.1.1.gz
slave testrb: /usr/bin/testrb1.9.1
slave testrb.1.gz: /usr/share/man/man1/testrb1.9.1.1.gz
Current 'best' version is '/usr/bin/ruby1.9.1'.