Skip to content

Instantly share code, notes, and snippets.

@jeffreyjackson
Created April 9, 2015 14:49
Show Gist options
  • Save jeffreyjackson/6243201485c8cbced707 to your computer and use it in GitHub Desktop.
Save jeffreyjackson/6243201485c8cbced707 to your computer and use it in GitHub Desktop.
resign .ipa with new CFBundleIdentifier and certificate
//How to resign an .ipa with a new CFBundleIdentifier and certificate
/*
Assumptions
1. .ipa filename is app.ipa
2. app is called MyApp
3. new provisioning profile resides at: ~/Downloads/AdHoc.mobileprovision
4. distribution certificate name is Company Certificate
5. may not need resource-rules parameter
6. provisioning profile is either for Adhoc, or Enterprise distribution
7. The bundle identifier needs to change. (Otherwise, look at my other pro-tip here: https://coderwall.com/p/cea3fw).
8. com.mycompany.newbundleidentifier is the new CFBundleIdentifier
*/
// Commands
unzip app.ipa
rm -rf Payload/MyApp.app/_CodeSignature/
/usr/libexec/PlistBuddy Payload/MyApp.app/Info.plist
//While in PlistBuddy you will need to do the following commands:
Set :CFBundleIdentifier com.mycompany.newbundleidentifier
save
quit
//Now we are back in Terminal!
cp ~/Downloads/AdHoc.mobileprovision Payload/MyApp.app/embedded.mobileprovision
codesign -f -s "iPhone Distribution: Company Certificate" --resource-rules Payload/MyApp.app/ResourceRules.plist Payload/MyApp.app
zip -qr app-resigned.ipa Payload/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment