Getting Started with Ruby

Ruby is one of the most powerful languages available today, and it's also one of the easiest to learn. This page contains everything you need to know to get started working with Ruby today.

Giving Ruby a Spin

You don't need to install anything on your computer if you just want to get your feet wet. Visit Try Ruby (In Your Browser!) and follow along with the interactive tutorial to see how easy Ruby's syntax is.

Getting Ruby set up on your machine

Ruby is relatively easy to install on nearly every platform. However, we recommend installing Ruby 1.8.7 at the moment, as many libraries you may want to try are not yet compatible with Ruby 1.9.

Windows

Windows users can grab the RubyInstaller For Windows which will install Ruby and the Rubygems package manager.

Once installed, open a Command Prompt and type

gem update --system

This updates Rubygems to the latest version if necessary.

Need a Ruby editor?

We recommend RedCar which you can install as a RubyGem.

gem install redcar
redcar install

Mac OS X

Both Leopard and Snow Leopard come with Ruby already installed. However, you will want to update Rubygems. Open a Terminal window and type

sudo gem update --system

Enter your password when prompted to complete the command.

This updates Rubygems to the latest version if necessary.

Need a Ruby editor?

We recommend Textmate (30 day trial, OS X DMG)

Linux (Ubuntu)

Use apt to install the necessary libraries

sudo apt-get install build-essential libopenssl-ruby libreadline-ruby1.8 \
ruby ruby1.8-dev irb rake rdoc libsqlite3-ruby libsqlite3-dev sqlite3 git-core libxml-ruby \
libiconv-ruby libxslt-ruby libxslt1-dev libxml2-dev

Next, install RubyGems to manage packages

mkdir src
cd src
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xzvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
sudo gem update --system

Need a Ruby editor?

We recommend VIm. A Rails plugin is available.

Rails

To install Rails on Windows, open a command prompt and type these commands:

gem install rails --version=2.3.5
gem install sqlite3-ruby mongrel

To install on Linux or Mac OSX, open a terminal and type:

sudo gem install rails --version=2.3.5
sudo gem install sqlite3-ruby mongrel
    

Build something

Now that you have Ruby installed, try building something fun.