Trying Out MacRuby & Hotcocoa


You could download/install MacRuby from the site, but I chose to stick to my normal ruby workflow and use rvm. So…

rvm install MacRuby

Some tutorials linked to from the MacRuby site seem to indicate that hotcocoa is bundled with MacRuby. Unless I’m doing something wrong, that’s not the case anymore. You can install the hotcocoa gem easily enough though:

gem install hotcocoa

What’s cool here is that with a standard (non-rvm) setup you would have had to do something like:

sudo macgem install hotcocoa

But because we’re using rvm it takes care of that for us.

Generating the Application

This step is similar to any other application generator just pass in the name of you application to the hotcocoa command:

hotcocoa DoubleRainbowApp

The first thing I did after generating the application was to add a .rvmrc file to the directory that looked something like this:

rvm MacRuby

Now we don’t have to worry about switching to MacRuby when we’re working on our MacRuby project. The .rvmrc file will automatically switch us the MacRuby whenever we cd into the project directory.