Installing Ruby and running a program
I’ve written my first post on a first, simple Ruby program. But I’ve not included notes there on installing and running Ruby programs. That’s because Ruby runs on a lot of different systems. And Ruby programs can be run in different ways.
You can find advice on installing Ruby here.
If you’re using a Mac your in luck as Ruby is already installed on Snow Leopard and Lion! You’ll need a text editor though. Try TextWrangler. When you save files save them as myprogram.rb. To run them open up a terminal and type:
ruby myprogram.rb
You’ll need to make sure you’re in the same directory you saved your Ruby program to. By default TextWranger saves files to Documents so you’ll need to type:
cd Documents ruby myprogram.rb
I hope that gets you started if you’re using a Mac. There are lots of instructions on getting up and running on other platforms around.