You can use several tools to install Ruby. This page describes how to use major package management systems and third-party tools for managing and installing Ruby and how to build Ruby from source.
Choose Your Installation Method
There are several ways to install Ruby:
- When you are on a UNIX-like operating system, using your system’s package manager is the easiest way of getting started. However, the packaged Ruby version usually is not the newest one.
- Installers can be used to install a specific or multiple Ruby versions. There is also an installer for Windows.
- Managers help you to switch between multiple Ruby installations on your system.
- And finally, you can also build Ruby from source.
The following overview lists available installation methods for different needs and platforms.
- Package Management Systems
- Building from source
Package Management Systems
If you cannot compile your own Ruby, and you do not want to use a third-party tool, you can use your system’s package manager to install Ruby.
Certain members in the Ruby community feel very strongly that you should never use a package manager to install Ruby and that you should use tools instead. While the full list of pros and cons is outside of the scope of this page, the most basic reason is that most package managers have older versions of Ruby in their official repositories. If you would like to use the newest Ruby, make sure you use the correct package name, or use the tools described further below instead.
apt (Debian or Ubuntu)
Debian GNU/Linux and Ubuntu use the apt package manager. You can use it like this:
As of writing, the
ruby-full package provides Ruby 1.9.3, which is an old
stable release, on Debian and Ubuntu.
yum (CentOS, Fedora, or RHEL)
CentOS, Fedora, and RHEL use the yum package manager. You can use it like this:
The installed version is typically the latest version of Ruby available at the release time of the specific distribution version.
Gentoo uses the portage package manager.
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
See the Gentoo Ruby Project website for details.
pacman (Arch Linux)
Arch Linux uses a package manager named pacman. To get Ruby, just do this:
This should install the latest stable Ruby version.
Homebrew (OS X)
On OS X El Capitan, Yosemite, and Mavericks, Ruby 2.0 is included. OS X Mountain Lion, Lion, and Snow Leopard ship with Ruby 1.8.7.
Many people on OS X use Homebrew as a package manager. It is really easy to get a newer version of Ruby using Homebrew:
This should install the latest Ruby version.
Ruby on Solaris and OpenIndiana
To install Ruby on OpenIndiana, please use the Image Packaging System (IPS) client. This will install the latest Ruby binaries and RubyGems directly from the OpenSolaris network repository for Ruby 1.9. It’s easy:
However, the third-party tools might be a good way to obtain the latest version of Ruby.
On other systems, you can search the package repository of your Linux distribution’s manager for Ruby, or the third-party tools might be the right choice for you.
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 of them also 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 do not need a separate installer, it comes with its own.
ruby-build is a plugin for rbenv that allows you to compile and install different versions of Ruby into arbitrary directories. ruby-build can also be used as a standalone program without rbenv. It is available for OS X, Linux, and other UNIX-like operating systems.
ruby-install allows you to compile and install different versions of Ruby into arbitrary directories. There is also a sibling, chruby, which handles switching between Ruby versions. It is available for OS X, Linux, and other UNIX-like operating systems.
If you are on Windows, there is a great project to help you install Ruby: RubyInstaller. It gives you everything you need to set up a full Ruby development environment on Windows.
Just download it, run it, and you are done!
RailsInstaller and Ruby Stack
If you are installing Ruby in order to use Ruby on Rails, you can use the following installers:
- RailsInstaller, which uses RubyInstaller but gives you extra tools that help with Rails development. It supports OS X and Windows.
- Bitnami Ruby Stack, which provides a complete development environment for Rails. It supports OS X, Linux, Windows, virtual machines, and cloud images.
Many Rubyists use Ruby managers to manage multiple Rubies. They confer various advantages but are not officially supported. Their respective communities are very helpful, however.
rbenv allows you to manage multiple installations of Ruby. It does not support installing Ruby, but there is a popular plugin named ruby-build to install Ruby. Both tools are available for OS X, Linux, or other UNIX-like operating systems.
RVM (“Ruby Version Manager”)
RVM allows you to install and manage multiple installations of Ruby on your system. It can also manage different gemsets. It is available for OS X, Linux, or other UNIX-like operating systems.
Uru is a lightweight, multi-platform command line tool that helps you to use multiple Rubies on OS X, Linux, or Windows systems.
Building from Source
Of course, you can install Ruby from source. Download and unpack a tarball, then just do this:
By default, this will install Ruby into
To change, pass the
--prefix=DIR option to the
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.