Different Settings for Development and Adhoc Builds in RubyMotion

Hi, I'm Hwee-Boon Yar

I write, ship and sell software products. iOS/OS X app developer based in Singapore, working remotely. This is my blog.


Need to run a code review on your codebase? Hire me

In our RubyMotion Rakefile, we'll want to be able to have different settings — especially for codesigning — when building for the simulator, device for development testing or device for adhoc/release testing. Based on this nice tip from Ben Sheldon, I've derived something simple for myself. Here's the relevant parts:

Motion::Project::App.setup do |app|
  env = if ENV['dev'] == '1'
        elsif ENV['adhoc'] == '1'
          'dev' #default


  if env == 'dev'
  elsif env == 'adhoc'

task :set_adhoc do
  ENV['adhoc'] = '1'

task :tf => [

Use the :tf task instead of :testflight and everything will work as expected:

rake retina=4   #This will default to dev=1, but it doesn't matter
rake device debug   #This will default to dev=1
rake tf notes="//"  #This will run testflight with adhoc=1

Note: Updated based on feedback from Ben Sheldon.

Like this post? Follow me @hboon on Twitter.