Skip to content

Instantly share code, notes, and snippets.

@subdigital
Created February 27, 2013 17:10
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save subdigital/5049635 to your computer and use it in GitHub Desktop.
Save subdigital/5049635 to your computer and use it in GitHub Desktop.
Script to install provisioning profiles on a build server
#! /bin/sh
# Takes a provisioning profile and installs it into the system path.
# This requires poking inside the provisioning profile and searching for the
# UUID present at the end of the file.
set -e
if [[ -z "$1" ]]
then
echo "USAGE: install_provisioning_profile PROVISIONING_FILE"
exit 1
fi
if [[ ! -f $1 ]]
then
echo "The file $1 does not exist"
exit 1
fi
mobile_provisioning_file=$1
echo "Processing $mobile_provisioning_file"
uuid=`grep "UUID" -A1 -a "$mobile_provisioning_file" | grep -o "[-A-Z0-9]\{36\}"`
echo "uuid is $uuid"
if [[ -z "$uuid" ]]
then
echo "UUID could not be found in $mobile_provisioning_file"
exit 1
fi
destination="$HOME/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"
cp $mobile_provisioning_file "$destination"
echo "Installed to $destination"
@Saumyadip-Pramanik
Copy link

Saumyadip-Pramanik commented Jan 17, 2020

Xcode: 11.3
The script is not working as the grep "UUID" -A1 -a "$mobile_provisioning_file" | grep -o "[-A-Z0-9]\{36\}" command is not returning anything.

Please replace it with security cms -D -i ${mobile_provisioning_file} | grep -aA1 UUID | grep -o "[-a-zA-Z0-9]\{36\}"

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