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: http://deb.li/ruby
Contents
-
Ruby in Debian
- Available interpreters in Debian 11 (bullseye)
- Available interpreters in Debian 10 (buster)
- Available interpreters in Debian 8 (jessie)
- Available interpreters in Debian 7 (wheezy)
- Selecting the default Ruby interpreter system-wide (wheezy only)
- Selecting the default Ruby interpreter on a per-user basis (wheezy)
- Installing Ruby versions not packaged in Debian
- Other Ruby-related wiki pages
Available interpreters in Debian 11 (bullseye)
Interpreter |
Package |
Notes |
MRI 2.7.4 |
|
Available interpreters in Debian 10 (buster)
Available interpreters in Debian 8 (jessie)
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: https://lists.debian.org/debian-ruby/2014/03/msg00077.html and here: https://lists.debian.org/debian-project/2014/02/msg00028.html )
Available interpreters in Debian 7 (wheezy)
The following Ruby interpreters are available in Debian Wheezy:
Interpreter |
Package |
Notes |
MRI 1.8.7 |
|
|
MRI 1.9.3 |
|
|
JRuby |
|
|
Rubinius |
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 (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 ruby1.8 ruby1.9.1 # 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 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, 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:
- While ruby-build is a great tool to build Ruby versions that are not available via APT, you should still use the Debian-packaged versions of Ruby whenever possible since they are tested and supported by the Debian community.
Please do not report bugs you encounter while using your homebuilt Rubies to the Debian team; Rubies built by yourself are not supported.
Other Ruby-related wiki pages
- BalasankarC/DebianRuby
- BalasankarC/DebianRuby/Packaging
- BalasankarC/DebianRuby/Packaging/Conventions
- BalasankarC/DebianRuby/Packaging/TestFailures
- BalasankarC/DebianRuby/Packaging/Tests
- JongminKim/Drafts/RubyPackaging
- Packaging/ruby-team-meta-build
- ReproducibleBuilds/TimestampsInRubyDocumentation
- Ruby
- Ruby/Packaging/Tests
- Ruby/Packaging/newUpstreamRailsApp
- SummerOfCode2020/ApprovedProjects/UpstreamDownstreamCooperationInRuby
- SummerOfCode2020/UnApprovedProjects/UpstreamDownstreamCooperationInRuby
- Teams/DebianRubyExtras
- Teams/Ruby
- Teams/Ruby/CrossBuilding
- Teams/Ruby/Drafts/StateOfTransitionNewPolicy
- Teams/Ruby/Drafts/StateOfTransitionNewPolicyReleaseTeam
- Teams/Ruby/Drafts/SwitchToOneNine
- Teams/Ruby/IRCMeetings
- Teams/Ruby/InterpreterTransitions
- Teams/Ruby/Jessie
- Teams/Ruby/Meeting/Brazil2016
- Teams/Ruby/Meeting/Kochi2024
- Teams/Ruby/Meeting/Paris2014
- Teams/Ruby/Meeting/Paris2015
- Teams/Ruby/Meeting/Paris2015/Report
- Teams/Ruby/Meeting/Paris2020
- Teams/Ruby/Meeting/Paris2023
- Teams/Ruby/Packaging
- Teams/Ruby/Packaging/Archive
- Teams/Ruby/Packaging/Conventions
- Teams/Ruby/Packaging/ITP
- Teams/Ruby/Packaging/Obsolete
- Teams/Ruby/Packaging/RailsApps
- Teams/Ruby/Packaging/RailsEngines
- Teams/Ruby/Packaging/Tests
- Teams/Ruby/Packaging/TransitionsPrimer
- Teams/Ruby/Packaging/gem2deb
- Teams/Ruby/Packaging/newUpstreamRailsApp
- Teams/Ruby/Packaging/origsource
- Teams/Ruby/RSpec3
- Teams/Ruby/Rails3
- Teams/Ruby/Rails3 (foo.tar.gz)
- Teams/Ruby/Rails3 (testapp.tar.gz)
- Teams/Ruby/Rails4.2
- Teams/Ruby/Rails6
- Teams/Ruby/Rails6/DependenciesTransition
- Teams/Ruby/Rails6/RailsBreakingChanges
- Teams/Ruby/Rails6/ReverseDependenciesTransition
- Teams/Ruby/Ruby2.2
- Teams/Ruby/RubyExtras
- Teams/Ruby/RubyExtras/OnRubygems
- Teams/Ruby/RubyExtras/Ruby19Porting
- Teams/Ruby/RubyExtras/RubyPackageTools
- Teams/Ruby/RubyExtras/UpstreamDevelopers
- Teams/Ruby/RubyInWheezy
- Teams/Ruby/Salsa
- Teams/Ruby/UpstreamPledge
- Teams/Ruby/Workflow
- Teams/Ruby/ruby2.5
- it/Ruby
- ja/Ruby