RubyMotion is a toolchain that lets you create native iOS applications using Ruby language. Developing with its help is a real pleasure and RubyMine makes it even cooler and more productive with the smart syntax highlighting, code completion, running, testing and debugging features.

0. Prerequisites

Make sure the following prerequisites are met:

You can also take a look on RubyMotion samples.

1. Creating a New RubyMotion App

Creating a new RubyMotion app is as simple as creating any other app. Go to

{span:class=shortcut}File \| New Project{span}
and choose
{span:class=shortcut}RubyMotion Application{span}

Choose an appropriate Ruby SDK and template, for example iOS:

RubyMotion application will be automatically created with the file structure needed:

2. Running Your App

When creating a new RubyMotion app RubyMine also creates default run/debug rake configurations (

{span:class=shortcut}Run \| Edit Configurations...{span}
) for you to run the app and tests:

In case of the iOS application you need just to run 'simulator' configuration with

{span:class=shortcut}Run \| Run...{span}
command to build your app and run it with the iOS simulator:

To run OS X application, use 'run' configuration that is created automatically instead of the 'simulator'.

3. Working in Code Editor

Working with RubyMotion code you can use code completion for Ruby code as well as for Objective-C code:

All the quick-fixes are also available:

Let's add some code and rerun:

4. Working in Console

With RubyMotion there is no need to rerun your app any time you want to change some code. You can use console for that. First of all point out to the screen element you want to play with. Use

{span:class=shortcut}Cmd + Mouse{span}
, the red border shows the element focused:

Now you can change a color for the label text for example:

And see the changes immediately:

5. Testing Your App

To run spec tests for your app run 'spec' configuration with

{span:class=shortcut}Run \| Run...{span}
command. Tests wil be run and the results will be shown in the UI:

6. Debugging Your App

RubyMine also allows debugging a RubyMotion app with a graphical UI. Set a breakpoint with

{span:class=shortcut}Run \| Toggle Line Breakpoint{span}
and run 'simulator' configuration with
{span:class=shortcut}Run \| Debug...{span}
command. Execution stops at breakpoint so you can analyze variables and run your code step by step:

If you prefer working with LLDB commands use the special LLDB tab:

7. Working on Device

RubyMine provides the ability to run, test and debug applications on the device if you are a registered Apple Developer. Read more on how to create a Developer account.

Add the *.mobileprovision file to the application root folder and change the Rakefile accordingly:

Now you can deploy the application to your device. Make sure the device is plugged and run 'device' rake task (

{span:class=shortcut}Tools \| Run Rake task...{span}

After deploying to the device, you can run 'device' configuration in the debug mode with

{span:class=shortcut}Run \| Debug...{span}
menu and the debugger will stop on the breakpoints when working with the app on the device:

You can also run your spec tests on the device with the 'spec:device' rake task.