Building a (PhoneGap) iOS app from Ubuntu entirely without Mac OS X

The Major: But, Fawlty, how did the starling get in the bar?
Basil: No, no, no. You were in the bar.
The Major: I was in the bar? Yes! Yes, I was!
Basil: And the starling was in the garden, and the rat was nowhere at all.

It is possible, with the aid of PhoneGap and Adobe’s PhoneGap Build service, to make an app for iOS, get it signed, and deploy it to an iPhone without having a Mac involved at all. Up until yesterday I would have sworn up and down that this was not possible, and I told a bunch of people that; making a PhoneGap app isn’t a problem from Ubuntu, but getting the necessary keys to get it signed is. However, thanks to a writeup from BreezeJS I now know that this is not the truth. It’s possible to make an iOS app in Ubuntu and get it signed, I’ve done it, and now I’ll walk through that process. This description owes a lot to the Breeze writeup without which I’d be nowhere, but exactly what the screens look like has changed a little. Links and instructions correct as of 11th February 2014.

Make a PhoneGap app

No instructions for this bit. Read the PhoneGap documentation. Once you’ve built that, you’ll have a www/ folder with the HTML, CSS, and JavaScript of your app in it.

Get a PhoneGap Build account and add your app

Also no instructions for this bit, other than to say this: the app bundle that you upload or pull from Github does not have to contain just the contents of your www folder. I pointed PGB at a Github repos which had the www/ folder at top level and other things in the repos too, and it worked fine. Remember that your config.xml file which configures PGB needs to be in the same folder as index.html.

Get an iOS developer account

Sign up for the Apple Developer Programme. To build iOS apps this will cost you sixty quid. Once you get an email saying that you have access to iTunes Connect, you’ve been approved. Do what it tells you and fill out a bunch of forms about your bank account and address and so on.

Set up certificates

Go to the Apple Developer Member Centre and choose Certificates, Identifiers & Profiles, then under iOS Apps choose Certificates. You’ll probably see a screen saying “What type of certificate do you need?”; if you don’t, there’s a [+] button to add a new certificate.

The first thing you need is the Apple intermediate signing certificate, available from this screen. At the bottom it says Worldwide Developer Relations Certificate Authority; download this AppleWWDRCA.cer file and keep it around somewhere.

Development p12 key

Now, set yourself up a development p12 key as follows.

# Generate your private key
openssl genrsa -out private.key 2048
# Generate a certificate signing request. Use your own email address!
openssl req -new -key private.key -out CertificateSigningRequest.certSigningRequest  -subj '/, CN=Joe Example, C=UK'

On the “What type of certificate do you need?” Apple page, say “iOS App Development”. Go through its little wizard and upload your CertificateSigningRequest.certSigningRequest file. It will give you back a ios_development.cer file.

# Convert ios_development.cer to ios_development.pem
openssl x509 -in ios_development.cer -inform DER -out ios_development.pem -outform PEM
# Convert ios_development.pem to ios_development.p12.  Enter a password and remember it for later.
openssl pkcs12 -export -inkey private.key -in ios_development.pem -out ios_development.p12

Distribution p12 key

Now, generate a distribution p12 key in the same way:

# Generate a certificate signing request. Use your own email address!
openssl req -new -key private.key -out DistCertificateSigningRequest.certSigningRequest  -subj '/, CN=Joe Example, C=UK'

On the “What type of certificate do you need?” Apple page, say “iOS App Development”. Go through its little wizard and upload your DistCertificateSigningRequest.certSigningRequest file. It will give you back a ios_distribution.cer file.

# Convert ios_distribution.cer to ios_distribution.pem
openssl x509 -in ios_distribution.cer -inform DER -out ios_distribution.pem -outform PEM
# Convert ios_distribution.pem to ios_distribution.p12.  Enter a password and remember it for later.
openssl pkcs12 -export -inkey private.key -in ios_distribution.pem -out ios_distribution.p12

Add your phone as a Device

On the Apple page, on the left, it has a “Devices” section. Add a new device. For this, you’ll need the UDID of your iPhone. Do not use one of the apps on the App Store to get this: Apple changed things in iOS 7 so that apps can’t read your real UDID: they get a vendor-specific fake one. If you’ve got what you think is the UDID of your phone and it begins in FFFF then it’s not your actual UDID; it’s a vendor-specific fake UDID, and that will not work here. Instead, plug your iPhone into your Ubuntu machine with USB, and then run

$ lsusb -v 2>/dev/null | grep -e "Apple Inc" -A 2 iManufacturer 1 Apple Inc. iProduct 2 iPhone iSerial 3 472585[censored]

The iSerial is your actual UDID. Use it to add your phone as a new Device on the Apple developer portal.

Add your app

Also on the left of the Apple page, there’s Identifiers > App IDs. Add a new App ID for the app you’re planning to build.

Get a Provisioning Profile

You now need a Provisioning Profile. This is a certificate which is specific to a (p12 key, app, device(s)) combination; that is, you need a new one of these for each combination of app-to-install and device-to-install-it-on. You can add more than one device to a provisioning certificate, though.

Under Provisioning Profiles on the left on the Apple page, add a new profile for your chosen combination of (key, app, device). It will give you a something.mobileprovision file to download.

Add keys to PhoneGap Build

In the PhoneGap Build Edit Account page, go to Signing Keys and upload your p12 key and mobileprovision file. Unlock the key by entering the password you created for it. On your app’s PGB page you should now be able to select that key under iOS and build your app for iOS. Finally, point your selected device’s Safari browser at the download URL for your iOS app ( and you’ll be able to install it.

Done. An iOS app built with Ubuntu. Thank you to Apple for opening up the ability to administer this stuff through the web, PhoneGap for providing the Build service, and Breeze for working out how to tie it all together.

More in the discussion (powered by webmentions)

  • A response was written at Static ... ( So here I am with a static blog. I was on Wordpress. I like Wordpress; in particular, I like the vitality of it. There’s a large community of people u…
  • Michiel responded at ... (
  • Mobile Development responded at RT @sil: @moreati cheers. I think that stuff was all already possible:… but always nice to have choices. Still can't uplo…