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:
- Create a directory called “Payload” (case sensitive).
- Copy/move your .app file into that directory.
- Zip the directory.
- 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:
1 2 3 4 5 6 7 8 9 10 11 12
To set this up on your system:
Copy and paste the script above into an empty text file. Save it as apptoipa.sh (or another name of your choosing).
Open up Terminal.app and navigate to the directory where you saved the script.
Make the script executable:
chmod +x apptoipa.shshould do it (if you used TextMate for step 1, the Shell Script bundle has a command to make the script executable).
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:
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.