Skip to content

Instantly share code, notes, and snippets.

@vfig
Last active November 11, 2015 09:56
Show Gist options
  • Save vfig/1778269ede659bea6a32 to your computer and use it in GitHub Desktop.
Save vfig/1778269ede659bea6a32 to your computer and use it in GitHub Desktop.
iOS dev command line operations that I find useful but have trouble remembering

Provisioning profiles

Find UUIDs of provisioning profiles in current directory:

find . -name '*.mobileprovision' -print0 | xargs -0 -t -n 1 security cms -D -i | grep -A1 UUID 2>&1

Convert .mobileprovision to .plist

security cms -D -i foo.mobileprovision -o foo.plist

Extract signing certificate from provisioning profile plist

/usr/libexec/PlistBuddy foo.plist -c 'Print DeveloperCertificates:0' > foo.cer

Certificates

List available valid codesigning certificates

security find-identity -v -p codesigning

Get SHA1 fingerprint of certificate

openssl x509 -in foo.cer -inform der -noout -fingerprint

Get full details of certificate

openssl x509 -in foo.cer -inform der -noout -text

Apps

Verify app signature

codesign -d -v foo.app

Extract signing certificates from app

codesign -d --extract-certificates=./foocert foo.app  # Extracts to ./foocert0, ./foocert1 etc.

Extract entitlements from app

codesign -d --entitlements :fooentitlements.plist foo.app

Xcode

Find location of xcrun tools

xcrun -sdk iphoneos -f PackageApplication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment