Adding IronRuby and JRuby to your OSX path

After downloading IronRuby and JRuby to do some hacking over the Christmas period, I wanted to add them to my PATH variable on OSX. In Windows, this is fairly easy to find but is hidden a few dialogs down.

In OSX, you need to edit the .bash_login file in your user directory. A simple nano ~/.bash_login will allow you to edit the file (replacing nano is your own favourite editor).

To add IronRuby to your path add:

export PATH=/Users/Ben/Library/ironruby-0.9.3/bin:$PATH

Import points:
1) The path to your IronRuby bin folder.
2) Ensure you add the existing $PATH to the end
3) Export the result to the current PATH variable. Note, this is case sensitive.

To add jRuby you do it in a very similar fashion. However, because of priorities and how jRuby works, unless you want jRuby to be the default, add it to the end of the path export

export PATH=/Users/Ben/Library/ironruby-0.9.3/bin:$PATH:/Users/Ben/Library/jruby-1.4.0/bin

You should now be able to see all your ruby interpreters.


Leave a Reply

Your email address will not be published. Required fields are marked *