Differences between revisions 11 and 12
Revision 11 as of 2011-11-13 02:20:52
Size: 2011
Comment:
Revision 12 as of 2011-11-13 02:22:03
Size: 2177
Comment:
Deletions are marked like this. Additions are marked like this.
Line 30: Line 30:
$ rbenv init
# Load rbenv automatically by adding
# the following to ~/.bash_profile:

eval "$(rbenv init -)"
$ echo 'eval "$(rbenv init -)"' >> .bash_profile

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 init 
# Load rbenv automatically by adding
# the following to ~/.bash_profile:

eval "$(rbenv init -)"
$ echo 'eval "$(rbenv init -)"' >> .bash_profile
$ 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