Skip to content

Instantly share code, notes, and snippets.

@mgkennard
Created November 5, 2013 16:56
Show Gist options
  • Save mgkennard/7322195 to your computer and use it in GitHub Desktop.
Save mgkennard/7322195 to your computer and use it in GitHub Desktop.
If dealing with ad hoc builds and not using TestFlight then this little Bash script has provided useful on a number of occasions. Save and run on command line passing in the path to the IPA. In return you will get the list of UDIDs in the provisioning profile it was built against,
#!/bin/bash
#
#
#
function usage
{
echo "Usage: $0 FILE"
}
function cleanup
{
if test -n "$tmp" ; then
rm -rf $tmp
fi
exit 1
}
ipa=$1
if test -z "$ipa" ; then
usage
cleanup
fi
if ! test -f $ipa ; then
echo "IPA $ipa does not exist"
cleanup
fi
tmp=/tmp/udid.$$
mkdir -p $tmp
if ! unzip -d $tmp $ipa > /dev/null 2>&1 ; then
echo "IPA $ipa is corrupt"
cleanup
fi
cd $tmp/Payload/*
if ! test -f embedded.mobileprovision ; then
echo "The embedded.mobileprovision file could not be found in the IPA. Is this a valid adhoc IPA?"
cleanup
fi
echo "The IPA $ipa will run on iOS devices with the following UDIDs:"
echo
grep --binary-files=text -o '<string>[0-9a-z]\{40\}</string>' embedded.mobileprovision | cut -b 9-48
echo
echo "Total number of UDIDs:"
grep --binary-files=text -o '<string>[0-9a-z]\{40\}</string>' embedded.mobileprovision | wc -l
cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment