Installation might take a few steps, but it's easy with RubyMotion. The most complicated part is that you're not told what editor to use. Read this section and spend some genuine time finding the right groove for your development. Once you've found an editor or IDE you're comfortable with, you'll be able to focus on your apps.
The process to get RubyMotion in place may seem time-consuming, but it's relatively simple. In this section, you'll get cozy with RubyMotion and the necessary tools installed, plus you'll get the editor of your choice by your side, so you can eventually write your first application!
Some flavors of Ruby can be a real headache to install depending on the system, but, fortunately, installing RubyMotion is simple. To get started with your installation of RubyMotion, you'll need a Mac running OS X 10.6 or higher.
To get the iOS software development kit (SDK), you'll need to grab Xcode from the Mac App Store. This should be second nature for most Mac users, but we'll go through the steps just in case you are completely unfamiliar with this process.
Applications
folder (usually in the Dock) or type "App Store" in Spotlight to load your App Store applications.The icon and install will look like this:
Finally, at some point Xcode will finish downloading and installing. We're almost done with Xcode now, but we need Command Line Tools (so RubyMotion can perform its magic). We need to perform the following steps to install Command Line Tools:
Now that you've downloaded everything you can close it all. You have all the tools you'll need from Apple.
It is important to keep Xcode and Command Line Tools up-to-date since this is how we will access features of the latest Apple SDK.
If you have downloaded an older version of Xcode (Pre-App Store), or you're fancy and you're looking to use a beta of the next Xcode before it is available in the App Store, you can change versions of Xcode at the command line using xcode-select
:
$ sudo xcode-select –switch /Path/To/Xcode.app/Contents/Developer
You can use this command to switch between multiple versions of Xcode, but this is generally uncommon in basic development.
That's right, it's time to buy! At the time of writing, there's a nice large Buy menu item on RubyMotion.com that brings you to their purchasing address (http://sites.fastspring.com/hipbyte/product/rubymotion).
Once you've gone through the standard purchasing process, HipByte will send you a purchase license key and an installer application. Install the application like any other Mac application install and you're ready to hit the ground running.
To activate your RubyMotion application you'll use the activate
command. Get your activation key ready and load up a terminal window. You'll need to type the following, and then follow the instructions presented to you to activate your copy of RubyMotion:
$ sudo motion activate
Activation is a one-time-per-machine task. It's probably a good idea to update your download of motion before we get started. To run a quick update, you keep open that same terminal and type the following command:
$ sudo motion update
You don't have to guess when updates are released. RubyMotion will often prompt you to run the preceding command if it notices your local version is not equal to the latest stable release.
You now have motion installed and you're ready to start writing apps! The following two sections are about where you write those apps.
Following in the footsteps of most Ruby development, you're not constrained to a particular editor and especially not to a particular IDE. This means you can write code in any text application! Obviously, you'll want some benefits, such as code formatting, completion, coloring, and so on, but you're not limited to the editors described.
If you haven't already fallen in love with an editor, the following is a Ruby / RubyMotion developer's guide to some popular and documented editors, so you can make a choice that suits you.
The editors are listed in the following list in alphabetical order:
-e
to the file located at /Library/RubyMotion/data/bridgesupport-ctags.cfg
will change your rake
ctags command to generate the tags file readable by Emacs. There's nothing Ruby proficient about this editor other than its stability and cost.I personally develop in either Vim or Sublime Text, depending on the operating system of the machine I'm using. Both are amazing with RubyMotion and easily take care of my development needs.
IDEs generally give you all the benefits of the normal text editors, but they'll usually hold your hand through additional characteristics such as source control, test run integration, autocompletion, refactoring tools, alerts, help notifications, and debugging. Though you can become highly dependent on an IDE, it can really help and guide you through your venture into a new programming experience. If you're looking to diminish the abruptness of any learning curve, an IDE is generally a good way to go.
If Ruby is old hat for you, you're probably familiar with, or have at least heard of, RubyMine. RubyMine is the most intelligent Ruby development tool I've come across. It's a full-fledged IDE that can handle your Ruby on Rails projects, as well as your RubyMotion development.
If you haven't already, give RubyMine a try. They have a free 30-day trial you can grab from http://www.jetbrains.com/ruby/.
The following screenshot shows the JetBrains installer:
Once you've downloaded RubyMine's DMG, you do the usual drag to the Application
folder, and, on the first run of the application, choose the Evaluate for free for 30 days option.
As previously mentioned, IDEs give you a lot of hand holding, which is great if you're new to either Git or the iOS framework methods/objects. RubyMine is no exception, with tightly integrated support on the wide array of tools used in RubyMotion. The Breakpoints and Rerun Simulator button are amazing for those small changes you need to get just right.
To view the IDE in action, check out this screencast:
http://tv.jetbrains.net/videocontent/rubymotion-support
If you're anything like me, the first thing you'll want to do is get rid of that bright background before it burns your eyes out. My favorite scheme is RailsCasts (Preferences | Editor | Colors & Fonts). Obviously, the IDE supports color schemes for all.
Additionally, if you come from the Vim world, there's a plugin called IdeaVim (Sublime Text has something similar) that allows you to apply all your wonderful Vim shortcuts inside the editor. Go to Preferences | Plugins | Install plugin to install the plugin from the disk (http://plugins.jetbrains.com/plugin/?id=164).