Ruby Installation

What is Ruby?

Ruby is a cross-platform, interpreted and object-oriented language. Ruby has been designed on the Principle of Least Surprise - Matz says "I wanted to minimize my frustration during programming, so I want to minimize my effort in programming. That was my primary goal in designing Ruby. I want to have fun in programming myself. After releasing Ruby and many people around the world got to know Ruby, they said they feel the way I feel. They came up with the phrase the principle of least surprise."

The year 2004 saw a massive surge of interest in Ruby, with the introduction of the Ruby on Rails Web application framework by David Heinemeier Hansson.

Yukihiro Matsumoto, commonly known as 'Matz' created the Ruby language in 1993. An interview with him in 2001, talks about the history of Ruby. Matz's "The Philosophy of Ruby" is another good read.

How Ruby can help you, in more detail

In David Black's book, 'Ruby for Rails', he mentions that a solid grounding in Ruby can serve you, as a Rails developer, in four ways:

  1. By helping you know what the code in your application (including Rails boilerplate code) is doing
  2. By helping you do more in, and with, your Rails applications than you can if you limit yourself to the readily available Rails idioms and techniques (as powerful as those are)
  3. By allowing you to familiarize yourself with the Rails source code, which in turn enables you to participate in discussions about Rails and perhaps even submit bug reports and code patches
  4. By giving you a powerful tool for administrative and organization tasks (for example, legacy code conversion) connected with your application

Downloading Ruby

As an open source language, Ruby has been ported to run on many different computer platforms and architectures. This means that if you develop a Ruby program on one machine, it's likely you'll be able to run it without any changes on a different machine. You can use Ruby, in one form or another, on most operating systems and platforms.

Though I talk about Ruby on a Windows platform, these notes are appropriate for Linux/Mac users as well.

The simplest way to get Ruby installed on a PC is by using the Ruby Installer for Windows. Download the latest verion of Ruby 1.9. After you have downloaded this, double-click this file and install Ruby on your PC, accepting all the defaults. After you have installed your Ruby software, the System Environment Variable path is already set to point to the bin folder of Ruby. Always check whether this has been set properly or not. If not, set it externally.

You can use any editor you like, as long as it's a plain-text editor and not a word processor) and a directory (a.k.a. a folder) in which to store your Ruby program files. The folder is separate from other work areas so that you can keep track of your practice program files.

You'll find two executables in the Ruby Windows distribution. ruby.exe is meant to be used at a command prompt (a DOS shell), just as in the Unix version. For applications that read and write to the standard input and output, this is fine. But this also means that anytime you run ruby.exe, you'll get a DOS shell even if you don't want one - Windows will create a new command prompt window and display it while Ruby is running. This may not be appropriate behavior if, for example, you double-click a Ruby script that uses a graphical interface (such as Tk), or if you are running a Ruby script as a background task or from inside another program. In these cases, you'll want to use rubyw.exe. It is the same as ruby.exe except that it does not provide standard in, standard out, or standard error and does not launch a DOS shell when run.

Do note that these instructions assume that you are going to use a Windows platform. For installation on other platforms, you can refer here.

Note: The Ruby Logo is Copyright (c) 2006, Yukihiro Matsumoto. I have made extensive references to information, related to Ruby, available in the public domain (wikis and the blogs, articles of various Ruby Gurus), my acknowledgment and thanks to all of them. Much of the material on rubylearning.com and in the course at rubylearning.org is drawn primarily from the Programming Ruby book, available from The Pragmatic Bookshelf.