#!/bin/sh # Install Provisioning profiles from the command line # Credit: http://stackoverflow.com/questions/11128284/provide-xcodebuild-with-mobileprovision-file # # Usage: # ./install_profile.sh /path/to/provisioning_profile # die() { echo "$@" 1>&2 ; exit 1; } if [ ! $# == 1 ]; then echo "Usage: $0 (/path/to/provisioning_profile)" exit fi provisioning_profile=$1 uuid=$(/usr/libexec/PlistBuddy -c 'Print UUID' /dev/stdin <<< $(security cms -D -i $provisioning_profile)) || die "Could not extract profile from $provisioning_profile" echo "Found UUID: $uuid" output=~/Library/MobileDevice/Provisioning\ Profiles/$uuid.mobileprovision echo "copying to $output.." cp "${provisioning_profile}" "$output" || die "failed to copy $provisioning_profile to $output" echo "done"