Last active
April 19, 2017 17:09
-
-
Save shazron/e0dc8fb575fcbac1bdc992631ff23fd3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# List Apple Developer Account Team IDs from Provisioning Profiles on your local machine. | |
# | |
# Source: https://gist.github.com/shazron/e0dc8fb575fcbac1bdc992631ff23fd3 | |
# License: Apachev2 | |
# | |
# You could also launch Xcode Organizer directly to the Provisioning Profiles section (to check for validity) by running: | |
# open ~/Library/MobileDevice/Provisioning\ Profiles/* | |
# | |
# Starting in Xcode 5, you can't get a whole list anymore in Xcode Organizer - you will need to download the iPhone Configuration Utility. | |
# | |
# In macOS 10.12 Sierra, you get this annoying 'error' even though the params to the 'security' tool are absolutely correct: | |
# security: SecPolicySetValue: One or more parameters passed to a function were not valid. | |
# | |
# Output in the CSV is in the form of: | |
# TEAM_ID, TEAM_NAME, PROVISIONING_PROFILE_FILE | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
FILES=~/Library/MobileDevice/Provisioning\ Profiles/*.mobileprovision | |
TMP_PLIST=`mktemp -d 2>/dev/null || mktemp -d -t 'list-team-ids'`/tmp.plist | |
LIST= | |
for f in $FILES | |
do | |
LIST+=`security cms -D -i "$f" > $TMP_PLIST && /usr/libexec/PlistBuddy -c 'Print :TeamIdentifier:0' $TMP_PLIST` | |
LIST+=", " | |
LIST+=`/usr/libexec/PlistBuddy -c 'Print :TeamName' $TMP_PLIST` | |
LIST+=", " | |
LIST+=$(basename $f) | |
LIST+="\n" | |
done | |
IFS=$SAVEIFS | |
echo -en $LIST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment