Skip to content

Instantly share code, notes, and snippets.

@djromero
Last active February 6, 2024 12:13
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save djromero/5dce571a1a40e8bd07f3 to your computer and use it in GitHub Desktop.
Save djromero/5dce571a1a40e8bd07f3 to your computer and use it in GitHub Desktop.
Download and install a single iOS provisioning profile for Xcode
#!/bin/sh
#
# Download and install a single iOS provisioning profile
# Requires https://github.com/nomad/cupertino
#
# Usage
# - Login to your account once:
# ios login
# - Configure TEAM and PROFILE (instructions below)
# - Run update_provisioning_profile.sh at anytime, usually after adding/removing devices to the profile
# Configure the team identifier
# Copy it from developer portal or just use cupertino to get it:
# ios devices
# Copy the string in parens and set it as TEAM
TEAM="team id"
# Configure the profile name you want to manage
# Copy it from developer portal or use cupertino to get a list (ignoring Xcode managed profiles):
# ios profiles --team ${TEAM} | grep -v 'iOS Team Provisioning Profile'
# Copy the name as-is and set as PROFILE
PROFILE="profile name"
# Fetch the profile using `cupertino` tool
# you need to run `ios login` once to setup the account
ios profiles:download "${PROFILE}" --team ${TEAM}
PROFILE_FILE=`echo $PROFILE | tr ' ' '_'` # `cupertino` tool will replace spaces with _
UUID=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i ${PROFILE_FILE}.mobileprovision)`
# copy where Xcode can find it
cp ${PROFILE_FILE}.mobileprovision "$HOME/Library/MobileDevice/Provisioning Profiles/${UUID}.mobileprovision"
# clean
rm ${PROFILE_FILE}.mobileprovision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment