IronRuby runs on .NET Framework 2.0 Service Pack 1 and above. Therefore, you need to have .NET Framework 2.0 SP1 or above installed on your machine before you start. Same goes for every machine on which you deploy your IronRuby applications.
You can download .NET Framework 2.0 SP1 from http://www.microsoft.com/downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5.
When you have the correct framework, we can move on and install IronRuby. The recommended method of installing IronRuby is by using the IronRuby installer. Follow the next steps to do so:
- Visit http://www.ironruby.net/download and click the Download IronRuby link.
The downloaded file is an MSI file. Double-click it to start the installation.
The first input you will be asked to enter is the installation folder for IronRuby. The default is your program files directory\IronRuby. The folder you choose will be referenced as the IronRuby installation folder throughout this book.
During the installation, you will be asked to select the features to install. The features that will be presented are as follows:
- Runtime: The main files of IronRuby. This feature is required.
- Standard Library: Ruby standard libraries. Needed if the standard libraries are used in IronRuby code.
- Samples: Sample IronRuby applications like WPF and PowerShell samples.
- Silverlight Binaries: Binaries needed for using IronRuby in Silverlight applications.
- Add IronRuby to %PATH%: Adds IronRuby binaries path to the PATH environment variable. This spares the need to provide full path to IronRuby executables when they are called from the command line.
- After approving all steps, the installation of IronRuby takes place.
Another option to install IronRuby is manually. IronRuby can be downloaded as a zip package. This lets you fully control the installation process but also forces you to execute the automatic tasks manually (optionally).
Follow the next steps to install IronRuby manually:
- Visit IronRuby's CodePlex homepage at http://ironruby.codeplex.com and click on the Downloads button on the page menu. In the downloads page, choose to download the IronRuby ZIP package.
- After the download is complete, extract this Zip file to the folder in which you want to place IronRuby (for example, C:\IronRuby). This folder will be referenced as the IronRuby installation folder throughout this book.
You're actually done now and can start using IronRuby. However, if you want IronRuby to be available from every location on your Windows system, you want to add the <installation folder>\bin path to the Windows PATH environment variable. Be aware, however, that this can be done only if you have administrative privileges.
To do that, follow the next steps:
- Navigate to Start > My Computer and right-click My Computer. On the menu, choose Properties as presented in Figure 4.1.
Figure 4.1 My Computer Properties Menu Item.
- In the open dialog, click Advanced System Settings as presented in Figure 4.2.
Figure 4.2 The Advanced System Settings Link.
- Click the Environment Variables button as presented in Figure 4.3.
Figure 4.3 The Environment Variables button.
- Find Path in the System Variables section (the lower part), select it, and click Edit as presented in Figure 4.4.
Figure 4.4 The PATH Environment Variable.
- In the Edit System Variable dialog, place the cursor at the end of the Variable Value field and add a semicolon (;) and <IronRuby installation folder>\Bin. For example, if you've extracted IronRuby to C:\IronRuby, you add ;C:\IronRuby\Bin to the Variable Value field as presented in Figure 4.5.
Figure 4.5 Setting the PATH Environment Variable.
- Click OK on all the dialogs you've opened during the process to save the new setting.
Congratulations, IronRuby is now installed on your machine.
After you extract IronRuby to the desired installation folder, you notice several folders there. Table 4.1 lists and describes the folders.
Table 4.1. IronRuby Folders and Their Roles
Contains license files, release notes, and the package readme file
Contains the IronRuby binaries, executables, and tools
Contains the standard libraries, including special IronRuby libraries and the RubyGems repository
Contains a few IronRuby samples and the IronRuby tutorial application
Contains binaries, samples, and tools for embedding IronRuby in Silverlight
Getting the Sources
If you'd like to go deep into IronRuby and go through its code, you need to download the source code of IronRuby. The source code is hosted on GitHub and uses Git as its source control application. You can download the source code in a Zip format from http://github.com/ironruby/ironruby/zipball/master.
To download the sources, you do not have to install Git on your machine. You need to do so only to contribute to the IronRuby code. For more information about how to contribute and how to use Git, look at the IronRuby wiki at http://wiki.github.com/ironruby/ironruby.