Ludicrous Software

Simple App to Ipa Script

I have a client who asks for .ipa files of test builds, but the Corona SDK (among others) creates .app files. The process of creating an .ipa from an .app file is pretty simple, but I wanted to automate it a little more. The result is this simple little bash script.

As you may know, the process of creating an .ipa file from an .app file looks like this:

  1. Create a directory called “Payload” (case sensitive).
  2. Copy/move your .app file into that directory.
  3. Zip the directory.
  4. Rename it to “whatever.ipa”.

This is all pretty simple, but if you do this via Finder it can get pretty tedious if you have to do it very often - for example, one current client requires separate localized builds of the app I’m working on. So for them, I need to repeat those steps for the English and the French versions (thankfully in this context, Canada only has two official languages). That’s a lot of clicking around with the mouse.

To automate the process, I whipped up this simple little bash script:


if [ -d "Payload" ]; then
  rm -fr Payload/*
  mkdir Payload
# if you'd rather copy the .app file, then replace the next line with:
# cp -r $1 Payload
mv $1 Payload
zip -r $2.ipa Payload
rm -fr Payload

To set this up on your system:

  1. Copy and paste the script above into an empty text file. Save it as (or another name of your choosing).

  2. Open up and navigate to the directory where you saved the script.

  3. Make the script executable: chmod +x should do it (if you used TextMate for step 1, the Shell Script bundle has a command to make the script executable).

  4. You’re all set

The script requires two arguments: the name of the .app file, and the name of the resulting .ipa file. For the latter, don’t include the .ipa extension, so usage would look like this:

Behemoth:Desktop darren$ /path/to/script/ App\_1\_0\_45

A few things to bear in mind:

  • This script will delete any existing Payload directory.
  • It will also delete the Payload directory after the .ipa file has been created.
  • It moves the .app file into Payload instead of copying it, so your .app file WILL BE DELETED. If you want to preserve the .app file, see the comments in the script. I haven’t tested it, but it ought to work.

This script is very straightforward and doesn’t do any checking for required arguments or anything like that, so exercise caution, use at your own risk, and do not use while driving.