Xcode can be downloaded and installed for free using the App Store application.

Xcode is Apple’s IDE. You do not need to use it when programming with RubyMotion, you can keep using your favorite text editor.

Open the 'App Store' application then search for "Xcode" in the search field.

Searching for Xcode in the App Store

Find Xcode from the result, then click on it.

Searching for Xcode in the App Store

That should open a new page where you can download Xcode.

Once Xcode is installed, you will need to install the Command Line Tools package, required by RubyMotion.

Open the Xcode application from your Applications folder, then go to the Preferences window and click on the Downloads tab. You should see the 'Command Line Tools' package in this list, make sure to hit the Install button.

Installing the Command Line Tools package

Okay, you should be all set now! You can close Xcode.

If you happened to have an older version of Xcode installed on your machine before you installed a newer Xcode from the App Store, you may want to type the following command in order to properly set up the default Xcode path.

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer