Translation(s): English - Italiano - Japanese

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 page is also available through this shortened URL:

Available interpreters in Debian 10 (buster)




MRI 2.5.5


JRuby 9.1.17


Available interpreters in Debian 8 (jessie)




MRI 2.1.5


JRuby 1.5.6


Unfortunately Rubinius did not make it into jessie.

As there are no (MRI) alternatives to choose from, update-alternatives support has been removed. (Longer explanation about the alternatives removal can be found here: and here: )

Available interpreters in Debian 7 (wheezy)

The following Ruby interpreters are available in Debian Wheezy:




MRI 1.8.7


MRI 1.9.3






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 (wheezy only)

To select the default Ruby interpreter on a system-wide basis, you can use the ruby-switch package. This needs to be done as root (or with sudo).

# ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
# ruby-switch --list
# ruby-switch --set ruby1.9.1
update-alternatives: using /usr/bin/gem1.9.1 to provide /usr/bin/gem (gem) in manual mode.
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
# ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
# ruby-switch --auto
update-alternatives: using /usr/bin/ruby1.8 to provide /usr/bin/ruby (ruby) in auto mode.
update-alternatives: using /usr/bin/gem1.8 to provide /usr/bin/gem (gem) in auto mode.
# ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Selecting the default Ruby interpreter on a per-user basis (wheezy)

Note: the instructions here use the command "rbenv alternatives", which is not available in Debian jessie.

To select the default Ruby for a given user account, you should use the 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 # or ~/.bashrc, depends on your setup
$ rbenv versions
$ rbenv alternatives 
$ rbenv versions
$ 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, 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]

Installing Ruby versions not packaged in Debian

You can use the ruby-build package to install Ruby interpreters that are not available in Debian. Note, however, what's written in the package README.Debian file:

  1. BalasankarC/DebianRuby
  2. BalasankarC/DebianRuby/Packaging
  3. BalasankarC/DebianRuby/Packaging/Conventions
  4. BalasankarC/DebianRuby/Packaging/TestFailures
  5. BalasankarC/DebianRuby/Packaging/Tests
  6. Packaging/ruby-team-meta-build
  7. ReproducibleBuilds/TimestampsInRubyDocumentation
  8. Ruby
  9. Ruby/Packaging/Tests
  10. Ruby/Packaging/newUpstreamRailsApp
  11. SummerOfCode2020/ApprovedProjects/UpstreamDownstreamCooperationInRuby
  12. SummerOfCode2020/UnApprovedProjects/UpstreamDownstreamCooperationInRuby
  13. Teams/DebianRubyExtras
  14. Teams/Ruby
  15. Teams/Ruby/CrossBuilding
  16. Teams/Ruby/Drafts/StateOfTransitionNewPolicy
  17. Teams/Ruby/Drafts/StateOfTransitionNewPolicyReleaseTeam
  18. Teams/Ruby/Drafts/SwitchToOneNine
  19. Teams/Ruby/IRCMeetings
  20. Teams/Ruby/InterpreterTransitions
  21. Teams/Ruby/Jessie
  22. Teams/Ruby/Meeting/Brazil2016
  23. Teams/Ruby/Meeting/Paris2014
  24. Teams/Ruby/Meeting/Paris2015
  25. Teams/Ruby/Meeting/Paris2015/Report
  26. Teams/Ruby/Meeting/Paris2020
  27. Teams/Ruby/Packaging
  28. Teams/Ruby/Packaging/Conventions
  29. Teams/Ruby/Packaging/Obsolete
  30. Teams/Ruby/Packaging/RailsEngines
  31. Teams/Ruby/Packaging/Tests
  32. Teams/Ruby/Packaging/TransitionsPrimer
  33. Teams/Ruby/Packaging/gem2deb
  34. Teams/Ruby/Packaging/newUpstreamRailsApp
  35. Teams/Ruby/Packaging/origsource
  36. Teams/Ruby/RSpec3
  37. Teams/Ruby/Rails3
  38. Teams/Ruby/Rails3 (foo.tar.gz)
  39. Teams/Ruby/Rails3 (testapp.tar.gz)
  40. Teams/Ruby/Rails4.2
  41. Teams/Ruby/Rails6
  42. Teams/Ruby/Rails6/DependenciesTransition
  43. Teams/Ruby/Rails6/RailsBreakingChanges
  44. Teams/Ruby/Rails6/ReverseDependenciesTransition
  45. Teams/Ruby/Ruby2.2
  46. Teams/Ruby/RubyExtras
  47. Teams/Ruby/RubyExtras/OnRubygems
  48. Teams/Ruby/RubyExtras/Ruby19Porting
  49. Teams/Ruby/RubyExtras/RubyPackageTools
  50. Teams/Ruby/RubyExtras/UpstreamDevelopers
  51. Teams/Ruby/RubyInWheezy
  52. Teams/Ruby/Salsa
  53. Teams/Ruby/UpstreamPledge
  54. Teams/Ruby/Workflow
  55. Teams/Ruby/ruby2.5
  56. it/Ruby
  57. ja/Ruby