I've been looking into iPhone development, but I've been having problems coming up with the answer to a certain question.

If I create an application on my Mac, is there any way I can get it to run on an iPhone without going through the app store?

It doesn't matter if the iPhone has to be jailbroken, as long as I can still run an application created using the official SDK. For reasons I won't get into, I can't have this program going through the app store.

Thanks for any help you can give!

+7  A: 

Yes, Once you have joined the iPhone Developer Program,and paid Apple $99, you can transfer your application to up to 100 iPhones or iPod touches.

Robert Höglund
Why is there a 100 install limit?
So people can't use this as a way to bypass the App store entirely.
+82  A: 

Official Developer Program

For a standard iPhone you'll need to pay the US$99/yr to be a member of the developer program. You can then use the adhoc system to install your application onto up to 100 devices. The developer program has the details but it involves adding UUIDs for each of the devices to your application package. UUIDs can be easiest retrieved using Ad Hoc Helper available from the App Store. For further details on this method, see Craig Hockenberry's Beta testing on iPhone 2.0 article

Jailbroken iPhone

For jailbroken iPhones, you can use the following method which I have personally tested using the AccelerometerGraph sample app on iPhone OS 3.0.

Create Self-Signed Certificate

First you'll need to create a self signed certificate and patch your iPhone SDK to allow the use of this certificate:

  1. Launch Keychain Access.app. With no items selected, from the Keychain menu select Certificate Assistant, then Create a Certificate.

    Name: iPhone Developer
    Certificate Type: Code Signing
    Let me override defaults: Yes

  2. Click Continue

    Validity: 3650 days

  3. Click Continue

  4. Blank out the Email address field.

  5. Click Continue until complete.

    You should see "This root certificate is not trusted". This is expected.

  6. Set the iPhone SDK to allow the self-signed certificate to be used:

    sudo /usr/bin/sed -i .bak 's/XCiPhoneOSCodeSignContext/XCCodeSignContext/' /Developer/Platforms/iPhoneOS.platform/Info.plist

    If you have Xcode open, restart it for this change to take effect.

Manual Deployment over WiFi

The following steps require openssh, and uikittools to be installed first. Replace jasoniphone.local with the hostname of the target device. Be sure to set your own password on both the mobile and root users after installing SSH.

To manually compile and install your application on the phone as a system app (bypassing Apple's installation system):

  1. Project, Set Active SDK, Device and Set Active Build Configuration, Release.

  2. Compile your project normally (using Build, not Build & Go).

  3. In the build/Release-iphoneos directory you will have an app bundle. Use your preferred method to transfer this to /Applications on the device.

    scp -r AccelerometerGraph.app root@jasoniphone:/Applications/

  4. Let SpringBoard know the new application has been installed:

    ssh [email protected] uicache

    This only has to be done when you add or remove applications. Updated applications just need to be relaunched.

To make life easier for yourself during development, you can setup SSH key authentication and add these extra steps as a custom build step in your project.

Note that if you wish to remove the application later you cannot do so via the standard SpringBoard interface and you'll need to use SSH and update the SpringBoard:

ssh [email protected] rm -r /Applications/AccelerometerGraph.app &&
ssh [email protected] uicache
Jason Weathered
Mine will not build - Xcode immediately gives a code signing error as soon as I try to build...
@Devoted I have updated the instructions for iPhone SDK 3.0.
Jason Weathered
Everything but uicache worked, see my post for details.
@Rev316 `uicache` should be there if you have the `uikittools` package installed.
Jason Weathered
I'm follow you but met this error: http://stackoverflow.com/questions/2161877/iphone-problem-when-deploy-to-real-device-the-identity-used-to-sign-the-execut
Also, you want to set up a private/public key pair over ssh to make things passwordless

It's worth noting that if you go the jailbroken route, it's possible (likely?) that an iPhone OS update would kill your ability to run these apps. I'd go the official route and pay the $99 to get authorized. In addition to not having to worry about your apps being clobbered, you also get the opportunity (should you choose) to release your apps on the store.

+1  A: 

*Changes/Notes to make this work for Xcode 3.2.1 and iPhone SDK 3.1.2

Manual Deployment over WiFi

2) Be sure to restart Xcode after modifying the Info.plist

3) The "uicache" command is not found, using killall -HUP SpringBoard worked fine for me.

Other then that, I can confirm this works fine.

Mac users, using PwnageTool 3.1.4 worked great for Jailbreaking (DL via torrent).

I have added a note about restarting Xcode. Thanks.As for `uicache`, do you have the `uikittools` package installed on your phone? It probably shows as "UIKit-related command line access utilities" in Cydia.I can confirm the killall seems to be working here on 3.0.1 but I have had problems with that in the past for reloading Springboard icons. I think this was during the 2.x days.
Jason Weathered
Ah. Thanks Jason, Appreciate the well documented post! May want to mention installing Cydia's UIKit Tools package for Jailbreak nubs like myself.

If you patch /Developer/Platforms/iPhoneOS.platform/Info.plist and then try to debug a application running on the device using a real development provisionen profile from apple it will probably not work. Symptoms are weird error messages from com.apple.debugserver and that you can use any bundle identifier without getting a error when building in XCode. Solution is to restore Info.plist.

Mattias Wadman
  • Build your app
  • Upload to a crack site
  • (If you app is good enough) the crack version will be posted minutes later and ready for everyone to download ;-)

Is there already a way to do that with iOs4 and iPhone SDK 4?