Differences between revisions 10 and 11
Revision 10 as of 2011-11-13 01:31:39
Size: 967
Comment:
Revision 11 as of 2011-11-13 02:20:52
Size: 2011
Comment:
Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
It's possible to switch between different Ruby interpreters as the default `ruby` program.
There are two ways of doing this:
It's possible to switch between different Ruby interpreters as the default `ruby` program by using update-alternatives. But when you change `ruby`, you probably also want to change the default `gem`, `irb`, etc, so there are shortcuts to changing all of those at once.
Line 20: Line 19:
  * system-wide, by using the '''update-ruby-alternatives''' tool. (Work in progress, not actually available yet)
  * per-user, by using the [[http://packages.debian.org/rbenv|rbenv]] package.
=== Selecting the default Ruby interpreter system-wide ===

[http://lists.debian.org/debian-ruby/2011/09/msg00087.html|TODO]

=== Selecting the default ruby interpreter on a per-user basis ===

To select the default Ruby for a given user account, you should use the [http://packages.debian.org/rbenv|rbenv] package:

{{{
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
$ rbenv versions
$ rbenv alternatives
$ rbenv versions
  1.8.7-debian
  1.9.3-debian
$ rbenv global 1.9.3-debian
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
}}}

It looks like it didn't work, but that's because the current shell already cached /usr/bin/ruby as the location of `ruby`. After you start a new shell, things will work and you will be able to switch the default ruby back and forth:

{{{
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
$ rbenv global 1.9.3-debian
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ rbenv global 1.8.7-debian
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
}}}

Ruby in Debian

This page documents how to install and use Ruby in Debian. For information about the development of Debian Ruby packages, please see Teams/Ruby.

this documentation is work in progress

Debian Wheezy

The following Ruby interpreters are available in Debian Wheezy:

Interpreter

Package

Notes

MRI 1.8.7

ruby1.8

MRI 1.9.3

ruby1.9.3

JRuby X.Y.Z

jruby

Rubinius 2.0

rubinius

Work in progress, not actually available yet

It's possible to switch between different Ruby interpreters as the default ruby program by using update-alternatives. But when you change ruby, you probably also want to change the default gem, irb, etc, so there are shortcuts to changing all of those at once.

Selecting the default Ruby interpreter system-wide

[http://lists.debian.org/debian-ruby/2011/09/msg00087.html|TODO]

Selecting the default ruby interpreter on a per-user basis

To select the default Ruby for a given user account, you should use the [http://packages.debian.org/rbenv|rbenv] package:

$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
$ rbenv versions
$ rbenv alternatives 
$ rbenv versions
  1.8.7-debian
  1.9.3-debian
$ rbenv global 1.9.3-debian 
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

It looks like it didn't work, but that's because the current shell already cached /usr/bin/ruby as the location of ruby. After you start a new shell, things will work and you will be able to switch the default ruby back and forth:

$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
$ rbenv global 1.9.3-debian 
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ rbenv global 1.8.7-debian 
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Debian Squeeze

TODO