Ironruby.1 – The Begining

Finally as promised here is first installment of Ironruby. In this, we will see how to install and run our first “Hello World” program. Before we start Ironruby I would like point you to some of ‘must have links’ for iron ruby developers. Here they are

1. Ironruby web site. This site has all the information for you to get started.

2. Jon Lam’s IUnkown web site. He is the Iron Ruby. His blogs are always worth a read so you must check out his blog at this web site.

3. Ironruby user forum.

4. Scott occasionally writes about Ironruby but his blogs are also good read for techies. One another blog you need to checkout while you are there would be Scott Hanselman. His blogs are also very absorbing.

Now that is out of the way, lets get started.

1. Download and install Ruby using ruby one click installer.

2. Download and install Tortoise SVN. After this you need to reboot the computer.

3. Now take a look at the “Gettting started” video by Jon Lam himself. Which has video instruction on how to checkout the latest code from Rubyforge follow that and checkout all the code to your c:\svn folder. If you do not want to watch it, then open a windows explorer and go to c:\ drive. Now right click on an empty screen where you will get a screen like the following


Now click the SVN Checkout this should popup a screen like the following


enter the information and click on OK button, now this should start checking out all the files to your c:\svn folder. Once check out is done, press ok to finish. At this stage you got all your IronRuby code in your svn folder.

4. Just to be sure, open a command box (cmd) and make sure ruby folders are in the path.

5. It looks like there was a problem with pathname2 gem with respect to the ruby so lets run on the command prompt

gem install pathname2

and wait for the gem to be installed.

6. Now change directory to c:\svn\trunk. At the command prompt now run,

rake compile

7. This should compile Ironruby and create rbx.exe in c:\svn\trunk\build\debug folder. thats it, you got yourself Ironruby running on your box. Isn’t it wonderful???

8. Change to c:\svn\trunk\build\debug and type in rbx (Ironruby interactive console). This should open up something like the following;


Now lets write our “Hello world”, at the prompt, type in print “Hello World” and hit enter and thats it. It will show the result and you are done.


lets run one more example, this one will print Hello Ruby 10 times, Ruby is a verbose language, you will be able to understand exactly what is trying to do by just reading it opposed to other programing languages (may be COBOL too).


type in exit and you are out of the ruby console. Please note that if you are trying to do some thing like the following

a =10

b = a + 2

on the console, you will get an error because current IronRuby build does not presist the local variables as shown in the first message that shows up. If you want to preserver local variables, the suggestion is to use global instead. So to make the above code to work, you need to change it to


b = $a + 2

That is it for now. If any of you have any questions or comments please let me know I will try my best answer the questions for you.

Happy coding…

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • Facebook
  • Mixx
  • Google

No Responses so far »

Comment RSS · TrackBack URI

Say your words

You must be logged in to post a comment.