Skip to content

Instantly share code, notes, and snippets.

@tranch
Forked from lodalo/re-sign iOS IPA
Created September 27, 2022 14:31
Show Gist options
  • Save tranch/82df058f4a0da4f8b6e1fea415c7c261 to your computer and use it in GitHub Desktop.
Save tranch/82df058f4a0da4f8b6e1fea415c7c261 to your computer and use it in GitHub Desktop.
Steps to re-sign an IPA file with a new provisioning profile
#Unzip the IPA
unzip Application.ipa
#Remove old CodeSignature
rm -R "Payload/Application.app/_CodeSignature"
#Replace embedded mobile provisioning profile
cp "path-to-provisioning-profile/MyEnterprise.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
#If you are resigning to submit to the AppStore you need to extract the entitlements to use later
#extract entithements
/usr/bin/codesign -d --entitlements :entitlements.plist Payload/Application.app
#determine the identity name to use for the next step
security find-identity -pcodesigning -v
#Re-sign with entitlements
/usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --entitlements entitlements.plist "Payload/Application.app"
# OR Re-sign without entitlements
/usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" "Payload/Application.app"
#Now, to verify what you have, you can do:
codesign -dvvv --entitlements - Payload/Application.app
#Re-package
zip -qr "Application.resigned.ipa" Payload
###OR you can use a GUI tool like AirSign (commercial) or iReSign (free).
#Tutorial for using iReSign: http://dev.mlsdigital.net/posts/how-to-resign-an-ios-app-from-external-developers/
###
#Parts of this gist were adapted from: http://stackoverflow.com/questions/15634188/resigning-an-ios-provisioning-profile
#Useful information about including entitlements is found at the iReSign tutorial and also
# here: http://stackoverflow.com/questions/6896029/re-sign-ipa-iphone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment