Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created August 4, 2011 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krainboltgreene/1125835 to your computer and use it in GitHub Desktop.
Save krainboltgreene/1125835 to your computer and use it in GitHub Desktop.
The ruby-lang.org downloads page

Downloading Ruby

There are three ways to install Ruby on your platform:

  • Build with third party tools
  • Install from package management systems
  • Compile from source

Third Party

Third party tools are generally the easiest way to install Ruby, and one of the very few ways to manage multiple versions of Ruby as well as different implementations.

Ruby Version Manager (Mac OS X, Windows XP/Vista/7, Linux, Unix)

RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.

To download Ruby Version Manager (RVM), you'll need two libraries:

  • curl
  • git

After installing both of those libraries you'll need to follow the instructions from the Ruby Version Manager site:

To install and/or update the latest code from the github repository ( requires git ):

$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

You can also visit the installation documentation.

Other details about the installation of RVM can be seen on the RVM website.

After you've installed RVM, you simply need to build Ruby:

$ rvm install 1.9.2

RVM will download the 1.9.2 latest head, build from source, and set the proper binaries up.

Package Manager

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Compiling Ruby Source

Installing from the source code is a great solution for when you are comfortable enough with your platform and perhaps need specific settings for your environment. It's also a good solution in the event that there are no other premade packages for your platform.

If you have an issue compiling Ruby, consider using one of the third party tools in the next section. They may help you.

  • Ruby 1.9.2-p290 (md5: 604da71839a6ae02b5b5b5e1b792d5eb) Stable (recommended)
  • Ruby 1.9.3 preview1 (md5: 0f0220be4cc7c51a82c1bd8f6a0969f3)
  • Stable Snapshot This is a tarball of the latest snapshot of the Stable branch.
  • Nightly Snapshot This is a tarball of whatever is in svn, made nightly. This may contain bugs or other issues, use at your own risk!

For information about the Ruby Subversion and Git repositories, see our Ruby Core page.

Here you can get the latest Ruby distributions in your favorite
flavor. The current stable version is 1.9.2.

Three Ways of Installing Ruby

You can get a copy of Ruby in a variety of ways, and different people
prefer each of the three methods for different reasons. Each will have
a section below, but here’s an overview:

  • Compiling from Source is the standard way that software has been
    delivered for many, many years. This will be most familiar to the largest
    number of software developers.
  • There are a few third party tools to install Ruby. These are often
    simpler for total newbies or the most advanced of users.
  • Finally, A few package management systems support Ruby. This will be
    most familiar to people who use one operating system for everything, and
    like to stick to those individual standards.

Finally, if you want to run multiple versions of Ruby on the same machine,
check the third party tools section and use rvm. It’s by far the best way
to accomplish that, unless you know exactly what you’re doing.

Compiling Ruby — Source code

Third Party Tools

Many Rubyists use third-party tools to help them install Ruby. They confer
various advantages, but are not officially supported. Their respective
communities are very helpful, however.

RVM

The most popular tool to install Ruby is rvm, for “Ruby Version Manager.”
Not only does it make installing Ruby incredibly easy, it also allows you to
install and manage multiple copies of Ruby on your system, as well as multiple
alternate implementations of Ruby.

RVM is only available for Mac OS X and Linux. Windows users should check out
pik for a similar project, or consider
using RubyInstaller, described in the next section.

As of this writing, as long as you have git installed,

$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

For the latest instructions on installing Ruby with rvm, check out the RVM
installation page
.

RubyInstaller

Package Management Systems

Linux

Debian
Ubuntu
Red Hat
Arch
Gentoo

Mac OS

Homebrew

MacPorts

Other Implementations of Ruby

Ruby, as a language, has a few different implementations. This guide has
been discussing the reference implementation, MRI, but there are also
others. They are often useful in certain situations, provide extra integration
to other languages or environments, or have special features that MRI doesn’t.

Here’s a list:

  • JRuby is Ruby atop the JVM (Java Virtual Machine),
    utilizing the JVM’s optimizing JIT compilers, garbage collectors, concurrent
    threads, tool ecosystem, and vast collection of libraries.
  • Rubinius could be labelled as the “Ruby in Ruby”
    implementation. More accurately, “The Rubinius bytecode virtual
    machine is written in C++, incorporating LLVM to compile bytecode to
    machine code at runtime. The bytecode compiler and vast majority of
    the core classes are written in pure Ruby”.
  • MacRuby is an “implementation of Ruby 1.9
    directly on top of Mac OS X core technologies”.
  • Cardinal is a “Ruby compiler
    for Parrot Virtual Machine” (Perl 6).
  • IronRuby is an implementation “tightly
    integrated with the .NET Framework”.

Some of those implementations, including MRI, follow the guidelines of
RubySpec, a “complete executable specification
for the Ruby programming language”.


Ruby On Linux

Depending on the distribution you are using, there are several ways to
install Ruby. You may use RVM (see above), you may download the source
code and compile by hand (see above). However, on some platforms,
there are package management solutions that make installing Ruby quite
easy. If you would like to stick to your distribution package system,
read on.

For example, on Debian or Ubuntu apt-get provides an easy and
elegant solution:

% sudo apt-get install ruby1.9.1-full

The above command installs the current stable version of Ruby 1.9.1.
If you prefer to install a Ruby 1.8 version, you can use:

% sudo apt-get install ruby-full

For irb and rdoc, you will need to enable the universe repository.

Ruby On OS X

Ruby 1.8.6 is fully supported in Mac OS X Leopard including Ruby on
Rails, Mongrel, Capistrano, and many other popular Ruby gems
(packages). For details, see the Ruby wiki at MacOS
Forge
.

Mac OS X Tiger is packaged with version 1.8.2 of Ruby, but, for those
who haven’t upgraded to Leopard, there are a number of options for
installing the latest version of Ruby.
Locomotive is a nice choice if you are
looking for something to get you up and running quickly for Rails
development. Using MacPorts or
Fink might be a little nicer for the
more technically savvy.

On MacPorts, you can install Ruby with…

% sudo port install ruby

Fink has a graphical interface (using Fink Commander) for installing Ruby.

Also, since OS X is based on Unix, downloading and installing from the
source is just as easy and effective as the other solutions.

For a detailed look at installing Ruby (and Rails), Dan Benjamin’s
excellent articles for
Tiger
,
for Leopard, and
for Snow Leopard
will get you up and running very quickly.

Ruby On Solaris and OpenSolaris

Ruby 1.8.7 are available for Solaris 8 through Solaris 10 on
Sunfreeware and Ruby 1.8.7 is available
at Blastwave. Ruby 1.9.2p0 is also
available at Sunfreeware now. An
optimized Ruby on Rails stack for Solaris 10 is available as
Coolstack from Sun’s
Cooltools project.

To install Ruby on OpenSolaris, please
use the Image Packaging System, or
IPS
client. This will install
the latest Ruby binaries and Rubygems directly from the OpenSolaris
network repository. It’s easy:

% pfexec pkg install SUNWruby18

This will install Ruby, Rubygems, common extensions and their
supporting libraries. This package also contains DTrace support and
performance optimizations. The locations of various artifacts are
described in the Ruby OpenSolaris ARC
Case
.

The other OpenSolaris distribution, called the Solaris Express
Community Edition or SXCE
comes
with Ruby preinstalled. The version, location etc., are the same as
with the vanilla OpenSolaris distribution, and are documented in the
above mentioned ARC case.

To install SVR4 packages manually, please visit the RubyOpenSolaris
project @ Rubyforge
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment