On Wednesday, I wanted to start hacking with RubyMotion. Because I was about to leave for a trip to HK, I didn't try it on my Mountain Lion (10.8) running iMac and instead resurrected an old Snow Leopard (10.6) running Macbook.
A quick read through RubyMotion's getting started guide and Apple's Developer portal made me realize that I needed XCode 4.5 in order to easily install the command line tools (autoconf, make, git, ...) and in order to use iOS SDK 6.
XCode 4.5 requires at least Mac OS X Lion (10.7), so had to upgrade the laptop (the Mac OS X Lion upgrade is not available anymore on the Mac App Store since Moutain Lion release and my Macbook is not supported by Mountain Lion, but I had thankfully kept on the iMac, a Mac OS X Lion installer I could re-use).
Once I got Lion, Xcode 4.5 and RubyMotion installed, I went through the Hello World example and encountered a few problems along the way.
undefined method `count' for ["./app/app_delegate.rb"]:Array
This happen when running rake and after googling it turns it was because Ruby Motion requires at least ruby 1.8.7 and Lion comes with 1.8.6. I therefore decide to install and use RVM to install newer rubies which led to the second problem.
Readline related compilation error when installing any version of ruby using RVM.
After following several leads that didn't work for my setup, I finally found two blogs mentioning an approach that actually works:
This allowed me to install ruby 1.9.* and I subsequently got further with the Hello World problem, straight into problem no. 3.
After compiling the Hello app, rake hangs while launching the iOS simulator. The simulator is visible but is frozen.
It turns out it was because I use tmux. If I re-run rake in new terminal, not in tmux, it works fine.
To get rake working with tmux, I had to install reattach-to-user-namespace using Homebrew and in my tmux session, instead of calling rake directly, I use:
reattach-to-user-namespace -l rake
It fixes the issue.
CODESIGN_ALLOCATE error about ambiguous matching certificates is thrown by ruby motion when running rake device.
a post in the RubyMotion google group led to that Apple Tech. note that immediately helped: I had an older expired iOS developer certificate in my Mac OS X keychain. Removing it fixed the problem.
After all of that, RubyMotion now works for me.