mocker: (Default)
Add MemoryShare This Entry
posted by [personal profile] mocker at 03:58pm on 04/01/2010 under , ,
After installing ruby on my shell server I noticed that all the commands are
suffixed w/ 1.9.1 which makes it a pain when writing scripts because
you have to do #!/usr/bin/ruby1.9.1 instead of #!/usr/bin/env ruby.

I found you can use update-alternatives to set the correct file associations.

sudo apt-get install ruby1.9.1 irb1.9.1 ruby1.9.1-examples rdoc1.9.1 ri1.9.1 rubygems1.9.1

sudo update-alternatives --remove-all gem

sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
                    --slave   /usr/bin/ri ri /usr/bin/ri1.9.1 \
                    --slave   /usr/bin/erb erb /usr/bin/erb1.9.1 \
                    --slave   /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1 \
                    --slave   /usr/bin/gem gem /usr/bin/gem1.9.1 \
                    --slave   /usr/bin/irb irb /usr/bin/irb1.9.1 \
                    --slave   /usr/share/man/man1/ruby.1.gz ruby.1.gz \
                              /usr/share/man/man1/ruby1.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   /etc/bash_completion.d/gem bash_completion_gem \
                              /etc/bash_completion.d/gem1.9.1
Mood:: 'happy' happy
There are no comments on this entry. (Reply.)

September

SunMonTueWedThuFriSat
      1
 
2
 
3
 
4
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30