Skip to content

Instantly share code, notes, and snippets.

@seanhenry
Last active April 24, 2024 09:14
Show Gist options
  • Save seanhenry/a5deddc7af4bbb6ac6d49d27101c3654 to your computer and use it in GitHub Desktop.
Save seanhenry/a5deddc7af4bbb6ac6d49d27101c3654 to your computer and use it in GitHub Desktop.
Resign an ipa and change the build number
APPNAME=App
BUILDNUMBER=123
CERTIFICATE="iPhone Distribution"
cp "${APPNAME}.ipa" "${APPNAME}.zip"
mkdir contents || true
unzip "${APPNAME}.zip" -d contents
codesign -d --entitlements :Entitlements.plist "contents/Payload/${APPNAME}.app"
plutil -replace CFBundleVersion -string "${BUILDNUMBER}" "contents/Payload/${APPNAME}.app/Info.plist"
rm -r "contents/Payload/${APPNAME}.app/_CodeSignature"
xattr -cr "contents/Payload/${APPNAME}.app"
codesign -s "$CERTIFICATE" -f --entitlements Entitlements.plist "contents/Payload/${APPNAME}.app"
cd contents
zip -qr "../${APPNAME}_Resigned.ipa" *
cd ..
rm -r contents
rm Entitlements.plist
rm "${APPNAME}.zip"
@khambadkone
Copy link

khambadkone commented Apr 23, 2024

The CERTIFICATE refers to the SHA1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment