Use Xcode 4.3.2 to build and run app on jailbroken iDevices

If you have jailbroken iDevices like me and no Apple Developer Certificates (quite expensive and I did not have finish my apps :p)

It is very easy to configure Xcode to do so.

Simply follow these steps :

First of all, we need a certificate.
Open the Keychain app from the LaunchPad > Utilities > Keychain Access

From the menus, choose “Certificate Assistant” > create a certificate
From the window, choose Certificate Type => Code Signing
and from the Text Input above, choose a name for our certificate such as JailbreakTests (You need to remember the name 😉 )

Now open a shell and type the following command

cd /Applications/

edit the Info.plist with nano

sudo nano Info.plist

and replace every XCiPhoneOSCodeSignContext => XCCodeSignContext

The third part is to remove code signing requirement :
from the current directory change to ./Developer/SDKs/iPhoneOSX.Y.sdk with X.Y egal to 5.1 for example

cd Developer/SDKs/iPhoneOS5.1.sdk/

and then

sudo nano SDKSettings.plist

and replace …_REQUIRED > NO to YES (SIGN_REQUIRED, etc…)

Now, we have to binary patch the
App :

cd /Applications/

cd iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/
sudo nano

copy and paste the following code in it :

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

now press ctrl+o and ctrl+x
and use

sudo chmod +x
sudo ./

You will se something like
55+1 … in
55+1 … out
27712 bytes transfered

Restart Xcode if it was open, if not, just launch it !

Open your project and change the build configuration from every Code Signing to “Don’t Code Sign”
This step will make Xcode not code signing the code

Now, we will code sign ourself the code, to enable it we execute this code :

mkdir -p /Developer/iphoneentitlements51
cd /Developer/iphoneentitlements51
curl -O
mv gen_entitlements.txt
chmod 777

and now, in the project, on the target add a new custom build phase to run script:
and copy/paste this code and replace iPhone Developer to the name you choose when you made your certificate:

export CODESIGN_ALLOCATE=/Applications/
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}/"

This code will auto sign the application

If your iDevices was not configure to do development, you need to open the Organizer and select your iDevice. Then choose “Use for development”

That’s it, you can now choose the iDevice instead of the emulators

Source :

One thought on “Use Xcode 4.3.2 to build and run app on jailbroken iDevices”

Leave a Reply