Installing ruby is easy enough using apt-get install ruby1.9.1.
But how can I set it as the default/system/global ruby in a automated fashion?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityInstalling ruby is easy enough using apt-get install ruby1.9.1.
But how can I set it as the default/system/global ruby in a automated fashion?
Simply make sure that the ruby found in $PATH is (a link to) the right one.
On my Ubuntu 12.04 (if I disable rvm, which I'm normally using to manage rubies),
which ruby
shows /usr/bin/ruby and ls -l which ruby
reveals that it's a link to
/etc/alternatives/ruby which is again a link, whose destination is intended to be managed by the update-alternatives command.
So I can either use update-alternatives to point it to the right version (probably the preferred way to do it), create the link manually, or make sure the $PATH variable ends up at a different link (perhaps one placed in $HOME/bin ) that points to the right ruby. (Note: the actually binaries on my system are installed in /usr/bin and are distinguished by having their version in their name, e.g. /usr/bin/ruby1.9.3).
All of these instructions are bash commands (or references to bash commands) so automation should be just about putting those commands in a script.
The program 'ruby' can be found in the following packages: * ruby1.8 * ruby1.9.1 Try: sudo apt-get install <selected package>
So I'm looking a way to automate this in a script somehow.
– Blankman
Feb 25 '13 at 1:39