With package managers or third-party tools, you have many options for installing and managing Ruby.
You may already have Ruby installed on your computer. You can check inside a terminal emulator by typing
This should generate information about the version
of Ruby installed.
Choose your installation method
There are several ways to install Ruby:
- On a UNIX-like operating system, using your system’s package manager is easier. However, the packaged version of Ruby may not be the newest.
- Installers can be used to install a specific or multiple version of Ruby. There is also an installer for Windows.
- Administrators help you switch between multiple versions of Ruby on your system.
- Finally, you can also build Ruby from source.
In Windows 10, you can also use the Windows Subsystem for Linux to install one of the supported Linux distributions and use any of the installation methods available on that system.
Here are the available installation methods:
- Debian package management systems,
- CentOS, Fedora, RHEL
- Arch Linux
- FreeBSD OpenBSD OpenBSD OpenIndiana
- Windows Package
- Chocolatey Package Manager for
- Other distributions
- installers ruby-install RubyInstaller
- Ruby Stack Managers
- Building from the source
If you can’t build your own Ruby and don’t want to use a third-party tool, you can use your system’s package manager to install Ruby.
Some members of the Ruby community feel that you should avoid package managers to install Ruby and that you should use dedicated tools instead.
Major package managers may install older versions of Ruby instead of the latest version. To use the latest version of Ruby, verify that the package name matches its version number. Or use a dedicated installer.
apt (Debian or
GNU/Linux and Ubuntu use the apt package manager.
You can use it like this:
yum (CentOS, Fedora,
or RHEL) CentOS, Fedora,
and RHEL use the yum package manager. You can use it like this:
The installed version is usually the latest version of Ruby available at the time of release of the specific distribution version
snap (Ubuntu or other Linux distributions)
Snap is a package manager developed by Canonical. It’s available out of the box on Ubuntu, but snap also works on many other Linux distributions. You can use it like this:
We have several channels per minor Ruby series. For example, the following commands change to Ruby 2.3:
uses the portage package manager
. To install a specific version, set RUBY_TARGETS in your make.conf.
See the Gentoo Ruby Project website for more details
. pacman (Arch Linux)
Arch Linux uses a package manager called pacman. To get Ruby, simply do this:
This should install the latest stable version of
Ruby. Homebrew (macOS
Ruby versions 2.0 and higher are included by default in macOS versions from at least El Capitan (10.11).
Homebrew is a package manager commonly used on macOS. Installing Ruby using Homebrew is easy:
This should install the latest version of Ruby
offers prepackaged, source-based methods for installing Ruby. Pre-built packages can be installed via the pkg tool:
a source-based method can be used to install Ruby using the Ports collection. This is useful if you want to customize build configuration options.
More information about Ruby and its surrounding ecosystem on FreeBSD can be found on the FreeBSD Ruby Project website.
OpenBSD as well as its adJ distribution has packages for all three major versions of Ruby. The following command allows you to view the available versions and
You can install several major versions side by side, because their binaries have different names (e.g. ruby27, ruby26).
The HEAD branch of the OpenBSD ports collection could have the latest version of Ruby for this platform a few days after its release, See Directory lang/ruby in the latest ports collection.
To install Ruby on OpenIndiana, use the Image Packaging System (IPS) client. This will install the Ruby and RubyGems binaries directly from the OpenIndiana repositories. It’s easy
However, third-party tools can be a good way to get the latest version of
Ruby. Windows Package Manager On Windows, you can use the Windows Package Manager CLI to install Ruby: Chocolatey Package Manager for Windows
Also on Windows, you can use the Chocolatey Package Manager to
Reuse existing msys2, or install your own for a
On other systems, you can search for Ruby in the package repository of your Linux distribution’s administrator. Alternatively, you can use a third-party installer.
the version of Ruby provided by your system or package manager is outdated, a newer one can be installed using a third-party installer
Some installers allow you to install multiple versions on the same system; associated administrators can help switch between different Rubies.
If you plan to use RVM as a version manager, you don’t need a separate installer, it comes with yours.
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 allows you to compile and install different versions of Ruby in arbitrary directories. chruby is a companion tool used to switch between Ruby versions. It is available for macOS, Linux, and other UNIX-like operating systems.
On Windows, RubyInstaller gives you everything you need to set up a complete Ruby
Just download it, launch it and you’re done!
If you are installing Ruby to use Ruby on Rails
, you can use the following installer:
- Bitnami Ruby Stack provides a complete development environment for Rails. It supports macOS, Linux, Windows, virtual machines, and cloud images.
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 they are not officially supported. However, you can find support within your respective communities.
ASDF-VM is an extensible version manager that can manage multiple Language Runtime versions per project. You’ll need the asdf-ruby plugin (which in turn uses ruby-build) to install Ruby.
Chruby allows you to switch between multiple rubies. You can manage rubies installed by ruby-install or even built from source.
rbenv allows you to manage multiple Ruby installations. While you can’t install Ruby by default, your ruby-build plugin can. Both tools are available for macOS, Linux, or other UNIX-like operating systems.
rbenv for Windows allows you to install and manage multiple installations of Ruby on Windows. It is written in PowerShell, which provides a native way to use Ruby for Windows users. In addition, the command line interface supports rbenv on UNIX-like systems.
RVM (“Ruby Version Manager”)
RVM allows you to install and manage multiple installations of Ruby on your system. It can also handle different gems. It is available for macOS, Linux, or other UNIX-like operating systems.
Uru is a lightweight, cross-platform command-line tool that helps you use multiple Rubies on macOS, Linux, or Windows systems
Of course, you can install Ruby from source. Download and unzip a tarball, then simply do this:
By default, this will install Ruby in /usr/local. To change, pass the -prefix=DIR option to the ./configure script.
More information about building from the source can be found in the Building Ruby instructions.
However, using third-party tools or package managers might be a better idea, because the installed Ruby won’t be managed by any tool.