mocker: (Default)
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

Reply

From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org


 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

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