Installing Ruby: Choose Your Installation Method
Installing Ruby: Choose Your Installation Method
Installing Ruby
With package managers or third-party tools, you have plenty of options to install and
manage Ruby.
You may already have Ruby installed on your computer. You can check inside a
terminal emulator by typing:
ruby -v
1 of 5 11/16/18, 9:55 AM
Installing Ruby https://www.ruby-lang.org/en/documentation/insta...
Some members of the Ruby community feel that you should avoid package managers
to install Ruby and that you should use dedicated tools instead.
It’s possible that major package managers will install older Ruby versions instead of
the latest release. To use the latest Ruby release, check that the package name matches
its version number. Or use a dedicated installer.
As of writing, the ruby-full package provides Ruby 2.3.1, which is an old stable
release, on Debian and Ubuntu.
The installed version is typically the latest version of Ruby available at the release
time of the specific distribution version.
portage (Gentoo)
Gentoo uses the portage package manager.
$ sudo emerge dev-lang/ruby
By default, this will try to install versions 1.9 and 2.0, but more versions are available.
To install a specific version, set RUBY_TARGETS in your make.conf. See the Gentoo
Ruby Project website for details.
2 of 5 11/16/18, 9:55 AM
Installing Ruby https://www.ruby-lang.org/en/documentation/insta...
Homebrew (macOS)
Ruby versions 2.0 and above are included by default in macOS releases since at least
El Capitan (10.11) all the way through Mojave (10.14).
FreeBSD
FreeBSD offers both pre-packaged and source-based methods to install Ruby. Prebuilt
packages can be installed via the pkg tool:
$ pkg install ruby
A source-based method can be used to install Ruby using the Ports Collection. This is
useful if you want to customize the build configuration options.
More information about Ruby and its surrounding ecosystem on FreeBSD can be
found on the FreeBSD Ruby Project website.
To install Ruby on OpenIndiana, please use the Image Packaging System (IPS) client.
This will install the Ruby binaries and RubyGems directly from the OpenIndiana
repositories. It’s easy:
$ pkg install runtime/ruby
However, the third-party tools might be a good way to obtain the latest version of
Ruby.
Other Distributions
On other systems, you can search the package repository of your Linux distribution’s
manager for Ruby. Alternatively, you can use a third-party installer.
Installers
3 of 5 11/16/18, 9:55 AM
Installing Ruby https://www.ruby-lang.org/en/documentation/insta...
If the version of Ruby provided by your system or package manager is out of date, a
newer one can be installed using a third-party installer.
Some installers allow you to install multiple versions on the same system; associated
managers can help to switch between the different Rubies.
If you are planning to use RVM as a version manager you don’t need a separate
installer, it comes with its own.
ruby-build
ruby-build is a plugin for rbenv that allows you to compile and install different
versions of Ruby. ruby-build can also be used as a standalone program without rbenv.
It is available for macOS, Linux, and other UNIX-like operating systems.
ruby-install
ruby-install allows you to compile and install different versions of Ruby into arbitrary
directories. chruby is a complimentary tool used to switch between Ruby versions. It’s
available for macOS, Linux, and other UNIX-like operating systems.
RubyInstaller
On Windows, RubyInstaller gives you everything you need to set up a full Ruby
development environment.
RailsInstaller uses RubyInstaller but gives you extra tools that help with Rails
development. It supports macOS and Windows.
Bitnami Ruby Stack provides a complete development environment for Rails. It
supports macOS, Linux, Windows, virtual machines, and cloud images.
Managers
Many Rubyists use Ruby managers to manage multiple Rubies. They allow easy or
even automatic switching between Ruby versions depending on the project and other
advantages but are not officially supported. You can however find support within their
respective communities.
chruby
4 of 5 11/16/18, 9:55 AM
Installing Ruby https://www.ruby-lang.org/en/documentation/insta...
chruby allows you to switch between multiple Rubies. It can manage Rubies installed
by ruby-install or even built from source.
rbenv
rbenv allows you to manage multiple installations of Ruby. While it can’t install Ruby
by default, its ruby-build plugin can. Both tools are available for macOS, Linux, or
other UNIX-like operating systems.
uru
Uru is a lightweight, multi-platform command line tool that helps you to use multiple
Rubies on macOS, Linux, or Windows systems.
By default, this will install Ruby into /usr/local. To change, pass the --prefix=DIR
option to the ./configure script.
You can find more information about building from source in the Ruby README
file.
Using the third-party tools or package managers might be a better idea, though,
because the installed Ruby won’t be managed by any tools.
5 of 5 11/16/18, 9:55 AM