Ruby on Rails
Installation (Version #74)

Ruby on Rails can be installed in a multitude of different ways and configurations. This covers the easiest and fastest ways to install Rails on Windows, Mac OS X and Ubuntu, optionally including Mongrel web server and MySQL. For more platform-specific guides, try GettingStartedWithRails.

1. Installing Ruby

Mac OS X

  1. Install the Apple Developer Tools (Xcode) found on the Mac OS X installation disk or downloaded from the Apple Developer Connection downloads page.
  2. Download and install MacPorts. This tool greatly simplifies the installation of Ruby on Rails and can be later used to update or remove Rails. MacPorts can be installed from a familiar .dmg image.
  3. Open the Terminal application and type the following command, followed by the return key. It will most likely prompt you to enter your password.
    sudo port install ruby

Ubuntu

Enter the following at the command line to install Ruby along with some bits and pieces to make later installations easier:

sudo apt-get install ruby irb ri rdoc ruby1.8-dev build-essential

2. Installing RubyGems

Mac OS X

Simply enter the following command into Terminal:

sudo port install rb-rubygems

Ubuntu

Another one-line installation:

sudo apt-get install rubygems

After installing RubyGems, you will need to add /var/lib/gems/1.8/bin/ to your path for easy access to any RubyGems you install later.

3. Installing Rails

On all systems with RubyGems installed, Rails can be installed with the following command:

sudo gem install rails -y

4. Installing Mongrel (Optional)

Ruby on Rails comes packaged with WEBrick, a web server suitable for development purposes. However, if you you would like to see increased speeds or are planning to deploy your application, Mongrel is a more suitable web server.

Mongrel can be installed with the following command:

sudo gem install mongrel -y

5. You’re finished!

You can now enter the following commands to test your Rails installation:

rails newrailsapp
cd newrailsapp
script/server

Direct your browser to http://localhost:3000/ and you should hopefully see the Rails welcome screen.

One-Step Installations

If you would rather have Ruby on Rails installed without any cryptic error messages, configuration or other stress in general, you should consider using Locomotive (Mac OS X) , Instant Rails (Windows) or RubyStack (Windows, Linux or Mac OS X) to install Rails. These packages contain everything you’ll need to get running with Rails. They have a simple installation process and are therefore highly suitable for beginners. Their only drawback tends to be that they are less customisable than a traditional Rails installation.

RubyStack is a preconfigured, self-contained installer for Apache, MySQL, Rails and a number of extensions such as Mongrel and ImageMagick. It runs on Windows, OS X and most Linux versions.

RM-Install for Mac OS X and Linux provides an single installer with Ruby, Rails, RubyGems, MySQL, SQLite, Subversion, Mongrel (optionally with Apache and a mongrel_cluster configuration), as well as commonly used libraries and tools (like Capistrano and RMagick).

The Ruby One-Click Installer for Mac OS X provides a simple installation for Ruby, RubyGems, Mongrel and the SQLite database. You will still need to install Rails using the instructions on this page though. This package is only 13MB, so you may find it useful if you would rather not download the Apple Developer Tools (Xcode) at around 900MB.

See Also

Ruby on Rails can be installed in a multitude of different ways and configurations. This covers the easiest and fastest ways to install Rails on Windows, Mac OS X and Ubuntu, optionally including Mongrel web server and MySQL. For more platform-specific guides, try GettingStartedWithRails.

1. Installing Ruby

Mac OS X

  1. Install the Apple Developer Tools (Xcode) found on the Mac OS X installation disk or downloaded from the Apple Developer Connection downloads page.
  2. Download and install MacPorts. This tool greatly simplifies the installation of Ruby on Rails and can be later used to update or remove Rails. MacPorts can be installed from a familiar .dmg image.
  3. Open the Terminal application and type the following command, followed by the return key. It will most likely prompt you to enter your password.
    sudo port install ruby

Ubuntu

Enter the following at the command line to install Ruby along with some bits and pieces to make later installations easier:

sudo apt-get install ruby irb ri rdoc ruby1.8-dev build-essential

2. Installing RubyGems

Mac OS X

Simply enter the following command into Terminal:

sudo port install rb-rubygems

Ubuntu

Another one-line installation:

sudo apt-get install rubygems

After installing RubyGems, you will need to add /var/lib/gems/1.8/bin/ to your path for easy access to any RubyGems you install later.

3. Installing Rails

On all systems with RubyGems installed, Rails can be installed with the following command:

sudo gem install rails -y

4. Installing Mongrel (Optional)

Ruby on Rails comes packaged with WEBrick, a web server suitable for development purposes. However, if you you would like to see increased speeds or are planning to deploy your application, Mongrel is a more suitable web server.

Mongrel can be installed with the following command:

sudo gem install mongrel -y

5. You’re finished!

You can now enter the following commands to test your Rails installation:

rails newrailsapp
cd newrailsapp
script/server

Direct your browser to http://localhost:3000/ and you should hopefully see the Rails welcome screen.

One-Step Installations

If you would rather have Ruby on Rails installed without any cryptic error messages, configuration or other stress in general, you should consider using Locomotive (Mac OS X) , Instant Rails (Windows) or RubyStack (Windows, Linux or Mac OS X) to install Rails. These packages contain everything you’ll need to get running with Rails. They have a simple installation process and are therefore highly suitable for beginners. Their only drawback tends to be that they are less customisable than a traditional Rails installation.

RubyStack is a preconfigured, self-contained installer for Apache, MySQL, Rails and a number of extensions such as Mongrel and ImageMagick. It runs on Windows, OS X and most Linux versions.

RM-Install for Mac OS X and Linux provides an single installer with Ruby, Rails, RubyGems, MySQL, SQLite, Subversion, Mongrel (optionally with Apache and a mongrel_cluster configuration), as well as commonly used libraries and tools (like Capistrano and RMagick).

The Ruby One-Click Installer for Mac OS X provides a simple installation for Ruby, RubyGems, Mongrel and the SQLite database. You will still need to install Rails using the instructions on this page though. This package is only 13MB, so you may find it useful if you would rather not download the Apple Developer Tools (Xcode) at around 900MB.

See Also