Developing for a Jailbroken iPhone A to Z (iOS 4.0.1)

Jailbreak Development for iOS4!

Vital Stats:
iOS 4.0.1
Xcode 3.2.3
Mac OSX 10.6.4 Snow Leopard
iPhones 3G, 3GS, 4 (I finally have the whole lineup!)

PROBLEM: I still can’t get iPhone 4 working. If you have one, please try it and help me out! UPDATE: Found the cause of the problem to be certain status bar libraries installed alongside other apps. I’m not sure why they cause the problem, but see full notes at the bottom of the post.

The Goal: As usual, we want to be able to click “build and go” in Xcode and get the app we’re working on to load to the phone and start up. Also, we want to be able to debug from within Xcode itself. After all, Xcode is cool, and terminal+makefiles+gcc+gdb is lame.

Abstract: The plan remains unchanged from the 3.x method. In fact, you commenters practically wrote this one for me. This time we’re going to tell Xcode that it doesn’t need to codesign for iPhoneOS targets, then we’re going to tell it don’tcodesign for iPhoneOS targets, then we’re going to tell it, well, actually, codesign but do it using our script, not your built in method.

The Process: With Xcode closed and your device unplugged from the computer,

    1. If you’ve done this step before for previous guides, you may ignore it. You’ll need a code signing identity in order to sign code to run on the device. Normally, this would be issued by Apple, but later on we’ll break the signature check so you can make a “Self-Signing Identity” using this guide from apple (coral). Note that you should name the identity “iPhone Developer” EXACTLY to avoid having to change a bunch of the steps below.
    2. On your jailbroken iPhone, install the app AppSync. Add the source to cydia. You’ll get a warning about pirating software: this patch, by virtue of breaking Apple’s DRM so that we can install our own app, also enables us to install cracked App Store apps. Don’t do that. It’s immoral, fails to support legitimate developers who should be rewarded for their effort, and perhaps above all, pirating $2 cell phone apps is just ultra lame. But since our purposes are not nefarious, dismiss the warning. From this repo, install the package AppSync for OS 4.0, and for good measure, reboot the device.
    3. Make some Plist adjustments, starting with SDKSettings.plist:
      cd /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk
      sudo cp SDKSettings.plist SDKSettings.plist.orig
      sudo vi SDKSettings.plist



      and change YES to NO
      then find


      and change YES to NO again. HINT: in vi, you can type the ‘/’ key in order to “Cmd-F”

    4. Now, move on to the platform Info.plist
      cd /Developer/Platforms/iPhoneOS.platform/
      sudo cp Info.plist Info.plist.orig
      sudo vi Info.plist

      Two times, the following appears:


      Find each occurrence and replace the block



    5. And now the real bad boy, some binary patching of Xcode:
      cd ~/Desktop
      vi script

      hit the “i” key and copy/paste:

      cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/
      dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255
      printf "\xc3\x26\x00\x00" >> working
      /bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original
      /bin/mv working iPhoneOS\ Build\ System\ Support
      chmod a+x iPhoneOS\ Build\ System\ Support

      type the keys, in order: “:” “x” “enter”

      chmod 777 script

      If it works right, you should see something like

      $ ./script
      223+1 records in
      223+1 records out
      111648 bytes transferred in 0.002678 secs (41692099 bytes/sec)

At this point, you’re done telling Xcode it doesn’t need to codesign. Now, we tell it don’t codesign:

    1. With a new project open and ready to go (presumably you want to debug this one, though once you change these settings once, they’ll persist from project to project) open Project>Edit Project Settings (from the menu). Click on the “Build” tab.
      Find “Code Signing Identity” and its child “Any iPhoneOS Device” in the list, and set both to the entry “don’t code sign”

      Screen shot 2010-01-11 at 1.05.42 AM
      Should look like this

      Now you’ve told Xcode “don’t codesign.”


  1. Almost done: time to tell Xcode “well, actually you should codesign.”
    mkdir /Developer/iphoneentitlements401
    cd /Developer/iphoneentitlements401
    curl -O
    mv gen_entitlements.txt
    chmod 777
  2. Just hit cancel.

    And finally, to link the device and computer. Plug your iPhone in and open Xcode. Open Window>Organizer. Select the device from the list on the left hand side, and click “Use for development.” You’ll be prompted for a provisioning website login, click cancel. It’s there to make legitimate provisioning easier, but doesn’t make illegitimate not-provisioning more difficult.

Now you’re good to go! But there’s just one last thing. You have to do this last part for every new project you make. Go to the menu Project > New Build Phase > New Run Script Build Phase. In the window, copy/paste this:

export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
/Developer/iphoneentitlements401/ "${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
codesign -f -s "iPhone Developer" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"

That will call the script you just downloaded in step 5 to sign our app with a fake signature. This is important only for debugging. If you do build and go otherwise, the app will load to the phone, but the app will fail to launch and you’ll get:

Error from debugger: The program being debugged is not being run

That should do it. Take all those steps and you should be home free for JBDev without paying $99.

CREDITS: Once again, credit for this process goes to various posters in this forum thread at All of these steps are there somewhere, it just took a while to re piece them together in the right combination.

iPhone 4 Issue (UPDATE see below): So the method above has been tested working for my 3G and my 3GS. I don’t have my 2G right with me, but I expect it’s no different from the previous method, given that it can’t run iOS4.

The problem that I run into is this:

[Session started at 2010-08-04 20:35:02 -0400.]
//GDB stuff
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-93925-69
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to thread 11523]
[Switching to thread 11523]
warning: Unable to read symbols for "/Library/MobileSubstrate/MobileSubstrate.dylib" (file not found).
// A bunch of other lib load warnings like this here...
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0.1/Symbols/usr/lib/libcrypto.0.9.8.dylib" (file not found).

Debugger stopped.
Program exited with status value:45.

The killer is that the app installs, launches, crashes, and then launches fine manually. But I also can’t connect GDB to the running process after the fact either, GDB claims the process isn’t running. I have no idea what’s going on. Anyone?

What gives?!

UPDATE (8/3/10): Totally by chance I happened to read this article on TUAW today about FaceTime. I didn’t pay much attention until about half way down something caught my eye:

…rather significant My3G bug — when installed, you cannot use your iPhone for native software development….

I had initially thought that maybe third party software was to blame but I meticulously disabled each MobileSubstrate extension I had one at a time and ruled them all out. Turns out that wasn’t good enough. The (since fixed) My3G bug was exactly the source of this issue, but I had actually uninstalled My3G and the problem persisted. The issue, it turns out, is with the status bar library Intelliborn uses in their products, IntelliStatusBarIcons. BUT, it doesn’t stop there. By individually uninstalling apps, I’ve found that Backgrounder (and NOT libstatusbar) also cause a dealbreaking bug. Instead of the program exiting with status:45, the new error is “Program received signal: “SIGUSR1”. at which point the application hangs. Conveniently, the workaround is easy, if annoying: For your particular project title, add an Override in Backgrounder. Hopefully this IS a bug in Backgrounder and not a byproduct of its function. But at least now you can debug again!

So partly I’m dumb and partly this is just a bummer. Full story in this post, but the general idea is that gdb catches a SIGUSR1 from Backgrounder and you have to ‘continue’ through it. And obviously, disabling Backgrounder for your app prevents the signal from getting sent.


  1. March 30, 2012

    Iulian i have the same problem, does compile but not run in the iPhone

  2. March 30, 2012

    thank you for the great article, thank you Shahin, I can revolve my problem !!!, thank you very much.

    In my last issue the solution is add armv6 in proyect-> build setting->architectures

  3. Iulian
    March 31, 2012

    For me only openGL game project wont work on the iphone(iphone 4 ios 4.3.3) , the rest of the project work on bouth (ont the simulator and the iphone)! Any ideea?

  4. Willy
    April 5, 2012

    After hours and hours of browsing and tweaking I finally figured this out :D! I can confirm that it works on iOS 5.1, but for some reason I can only get it to build in Xcode 3.2.6. In Xcode 4.3.2. I get “CodeSign error: code signing is required for product type “Application” in SDK “iOS 5.1”
    Would really love some assistance if you guys could.

  5. Willy
    April 7, 2012

    Thanks you very much Shahin, that saved me a lot of frustration!

  6. April 10, 2012

    @Dave, paying $99 for device app deploying, testing or debugging IS NEVER a WASTE of MONEY…and never will… 🙂 poor self-teach kid like me try what Alex and others Shared to is solely to SAVE MONEY,.because personally i can’t afford paying in dollars.

    Thanks Alex! And all who helped here..
    It ‘WORKS’ for me.. MY system: Mac OSX Lion 10.7.3, Xcode 4.2.1 iOS SDK 5.0.1, and JB’ed iPad2 iOS 5.0.1..
    Just follow Meg’s advice:

    to use this path:
    /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/iPhoneOS Build System Support.xcplugin/Contents/MacOS/

    …if you have problems in VIM editing stuff:

    …or…like me, if you’re not much versed in doing so, you can use PlistEdit Pro.. any PlistEditor,. just learn how to duplicate the original copy, edit outside the directory, then put it back onto the original directory to replace the edited plist file.

    ..make sure to type and execute the codes one-at-a-time and with extreme caution on any typos.. 🙂

    Good luck!
    🙂 Happy coding!

  7. pakee
    May 10, 2012

    Thanks! Just tried this on a hackintosh running xcode 4.3.2 (OSX Lion 10.7.4) and it works great (including debugging on the device). Just wanted to point out a few modifications to the instructions I had to make to get it to work:

    1. As mentioned by Shahin, locations of plist files is now

    2. 1st line of script should read:
    cd /Applications/\ Build\ System\ Support.xcplugin/Contents/MacOS/

    3. You now have to run script using sudo:
    sudo ./script

    4. Change first line of build phase script
    export CODESIGN_ALLOCATE=/Applications/

    Hope this helps someone

  8. pakee
    May 10, 2012

    Forgot to mention, to be able to and run on a device running older firmware (e.g. 4.2), I had to change the “iOS Deployment target” version in the project build settings

  9. Delasi
    May 11, 2012

    yes i do encountered problems “pakee” mentioned above.
    and it’s all solved now with the help of his tips.
    Thank you ~!

  10. VikasG
    May 20, 2012

    Worked great on Xcode4.2 on Lion. Thank you!

  11. Vdue
    May 28, 2012

    Lion 10.7.4; XCode 4.3.2; iPad3 iOS 5.1.1; JB Absinth 2.0.1

    I do not get it to work.

    Adapted the modifications suggested by pakee

    Step 5 gave me:
    55+1 records in
    55+1 records out

    In Xcode:
    iOS Target: 5.1
    Code Signing: Don’t Codesign

    I can create an IPA project file and upload it via iTunes to the iPad.
    I can start the app on iPad, however, the app closes instantly without crash report.

    Help appreciated

  12. Almost there
    May 31, 2012

    I did most of it, but am having trouble with step 6, where it says “open Project>Edit Project Settings (from the menu). Click on the “Build” tab.” I can’t find Project anywhere on the menu. I am using XCode 4.
    Thanks for the help.

  13. Jake
    June 8, 2012

    hi i am having the same problem as Vdue everything is fine the app starts and it closes instantly. Please help

  14. Jake
    June 8, 2012

    so i found the “solution” or idk more of a work around. put your phone in safe mode. then you will be ok….. if anyone knows any other way let me know!!

  15. Serkan
    June 15, 2012

    worked on 10.6.8 on vm virtualbox on windows 7. Thank you. It allowed me to write ios applications without buying a mac!

  16. Dipen Chauhan
    July 25, 2012

    Is there a similar guide for Xcode 4.3.1 for iOS 5.1 ?

  17. ApPropriate
    August 13, 2012

    The techniques outlined in Alex’s guide with the folder location updates noted in the comments work with Xcode 4.4 iOS 5.1.1r1 but now adding the run script build phase to add self signed entitlements to a project is REQUIRED (no longer an option only needed for debugging). Apps will install but will not be allowed to run on a newer iOS (i.e. starting with 5.1.1) without signed entitlements even with AppSync installed.
    Thank you Alex!

  18. Taitac
    August 27, 2012

    I am getting an error when i try and build my project:
    /bin/sh: /Users/xxxxxxxxx/Library/Developer/Xcode/DerivedData/HelloWorld-ssmarcbfferolyggwwsaprblnfdc/Build/Intermediates/ (null): bad interpreter: No such file or directory

    Although the path is correct and the files names of the .sh is correct.

  19. Taitac
    August 27, 2012

    ok now i am getting :

    iPhone Developer: this identity cannot be used for signing code
    Command /bin/sh failed with exit code 1

    although i do have it in my keychain (login)

  20. Taitac
    August 27, 2012

    nevermind….used another certificate 🙂 all good, thanks

  21. August 30, 2012

    Hey guys, when I try to run my project I have this error :

    Dest must be .xml (for ldid) or .xcent (for codesign)
    “iPhone: no identity found
    Command /bin/sh failed with exit code 1

    This identity ‘Iphone’ comes from the script add in Xcode to run when building a project : codesign -f -s “iPhone Developer” —entitlements “${BUILT_PRODUCTS_DIR}/ ….. etc….

    Thanks in advance for your help,

  22. SungRim Huh
    September 5, 2012

    “iPhone: no identity found

    probably means that you don’t have any iPhone or iTouch connected to use for Xcode.

  23. […] gerekli adımları takip ederek uygulamayı telefonunuzda da çalıştırıp deneyebliirsiniz: Developing for a Jailbroken iPhone A to Z (iOS 4.0.1) burada anlatılan 4.0.1 için fakat 4.2.1 için de aynı adımları 4.0.1 yazan yerlere 4.2.1 […]

  24. January 4, 2013

    AppSync is not available anymore… any alternative?

  25. January 4, 2013

    A guy give me a better alternative : jailcoder. Easier et faster but I have not try it personally.

  26. Oneiros
    January 4, 2013

    Ahah… I’m the JailCoder creator 🙂
    JailCoder is not an alternative, it just use the same method explained in this article, using a user-friendly and automatic approach (just a few clicks and no terminal skills required)
    So… JailCoder needs AppSync too

  27. January 4, 2013

    Do you have try to contact the creator of Appsync to have some news ?

  28. DetoXhun
    January 17, 2013

    AppSync from insanelyi repo doesn’t work?

  29. Taitac
    February 4, 2013

    Will this be updated for IOS 6 ? or is it the same way ?

  30. February 4, 2013

    As it stands, AppSync is no longer distributed, so this method won’t work anymore (and some other means of breaking signature checking would be needed). I’m pretty sure you can just use ldid before deploying to device as you would if you were signing for the cydia app store, but I don’t know enough about it. I may come up with a new guide in the future, but I’m not sure if I’ll be able to find the time/necessity.

  31. Taitac
    February 4, 2013

    but the appsync is available as a deb to be installed if someone doesnt have it. Wouldnt that work ?

  32. February 4, 2013

    Well, certainly it is, but I’d be shocked if the old .deb works on iOS 6+. Apparently the upgrade path for jailbreak apps was relatively rocky, I’d be totally surprised if an out-of-date version of such a low level modification still worked. And for that matter, it’s not getting updated going forward.

  33. blanxd
    February 4, 2013

    AppSync 2.2 does the job on 6.1 just fine. Ie. from i***** Besides, with Xcode 4.6 the “5. real bad boy binary thing” isn’t relevant even.

  34. Taitac
    February 5, 2013

    yessss sinful released a new appsync 🙂 for IOS 4/5/6

  35. Gabrio
    April 3, 2013

    It’s worth noting that for a fresh Xcode 4.6.1 install, the binary patching step has changed, the second line of the script should read:

    cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/iPhoneOS\ Build\ System

    The PrivatePlugIns part changed.

  36. It is appropriate time to make some plans for the future and it’s time to be happy. I have read this post and if I could I desire to suggest you few interesting things or suggestions. Perhaps you can write next articles referring to this article. I want to read more things about it!

    Here is my blog post :: how to make a Android App

  37. blanxd
    October 2, 2013

    Tested with Xcode 5, did everything except the “5. bad boy binary step”, and it works 🙂 Using an iPhone 4 on iOS 6.1.2 still.

  38. Troy
    May 13, 2014

    Tested with Xcode 5.1.1 on OSX 10.9.2, iPhone 5 with iOS 7.0.6, and it worked.

    I also skipped “5. bad boy binary step” and I had to change all the /Developer paths to /Applications/ in the scripts.
    I also note that there were 3 mentions of “XCiPhoneOSCodeSignContext” instead of 2; I changed them all.

Leave a Reply

Your email address will not be published. Required fields are marked *