My Life As A Blog

Ruby Tuesday #2 : Setting up

leave a comment »

The first thing to do is to install Ruby.  Along the way, I’m going to use a PC and a Mac.  Let’s start with the Mac.  Open a terminal and type:

ruby -v

On the Mac I used, which is running Tiger, I got the following response:

ruby 1.8.2 (2004-12-25) [universal-darwin8.0]

OK, so Ruby is already installed on the Mac.  But it’s not the latest version, which, at the time of writing, is 1.8.6.  Fortunately, there’s a download here on the Apple site that installs 1.8.6 – along with some other bits and bobs including RubyGems.  Once installed, open a fresh terminal window and type:

ruby -v

I now see:

ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]

So, we now have Ruby 1.8.6 installed on the Mac.  Clearly, a Hello World is called for.  Type:


That launches the interactive ruby shell and type:

puts "Hello World"

which produces:

Hello World
=> nil

Great. Let’s move onto the PC.  On the machine I used, running Vista, Ruby wasn’t already installed. There’s a one-click installer for Windows – you can find it here.  You can pick the version you want to install, I picked “1.8.6-26 Final Release”.  It installs:

the Ruby language itself, dozens of popular extensions and packages, a syntax-highlighting editor, an execution environment, and a help file that contains the full text of the book, Programming Ruby: The Pragmatic Programmer’s Guide.

Test the installation with the now familiar:

ruby -v

Here’s the output I got:

ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

Finally, run the same steps for Hello World via the interactive shell.  I got the same result as I got on the Mac, which is nice.

Along the way I found a couple of links that might be useful to anyone else starting Ruby:

Getting started tips from David Heinemeier Hansson, the creator of Rails.

So that’s Ruby installed.  Now there’s just the small matter of learning the language…


Written by remark

April 22, 2008 at 8:00 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: