I couldn\'t find anything on this (maybe I\'m just using the wrong search terms..):
We\'re trying to build a sensible continuous integration setting for our apps. To have a
Sigh can manage provisioning profiles for you. However, it doesn't support installing profiles that you've fetched yourself already. However, I still found it valuable to look at their source for how they actually install a profile once they've downloaded it.
Thankfully, it's very similar to James J's answer:
def self.install_profile(profile)
UI.message "Installing provisioning profile..."
profile_path = File.expand_path("~") + "/Library/MobileDevice/Provisioning Profiles/"
uuid = ENV["SIGH_UUID"] || ENV["SIGH_UDID"]
profile_filename = uuid + ".mobileprovision"
destination = profile_path + profile_filename
# If the directory doesn't exist, make it first
unless File.directory?(profile_path)
FileUtils.mkdir_p(profile_path)
end
# copy to Xcode provisioning profile directory
FileUtils.copy profile, destination
if File.exist? destination
UI.success "Profile installed at \"#{destination}\""
else
UI.user_error!("Failed installation of provisioning profile at location: #{destination}")
end
end
I have a script to perform this local installation for me:
#!/bin/bash -euo pipefail
BASH_SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$BASH_SOURCE_DIR"
# by default bash passes the glob characters if nothing matched the glob
# disable that
# http://stackoverflow.com/a/18887210/9636
shopt -s nullglob
# this creates a proper bash array, which we need since our profiles
# have funny characters in them
MOBILE_PROVISIONS=(*.mobileprovision)
# re-enable default nullglob behavior
shopt -u nullglob
# On a brand new machine that has never run any app on a development device
# the ~/Library/MobileDevice/"Provisioning Profiles" directory doesn't exist
mkdir -p ~/Library/MobileDevice/"Provisioning Profiles"
for mobileprovision in "${MOBILE_PROVISIONS[@]}"
do
uuid=$( ./uuid-from-mobileprovision.bash "${mobileprovision}" )
cp "${mobileprovision}" ~/Library/MobileDevice/"Provisioning Profiles"/"${uuid}".mobileprovision
done
which depends on another uuid-from-mobileprovision.bash
script:
#!/bin/bash -euo pipefail
if [ ! -f "${1}" ]
then
echo "Usage: $0 " 1>&2
exit 1
fi
UUID=$( grep --text --after-context=1 UUID "${1}" | grep --ignore-case --only-matching "[-A-Z0-9]\{36\}" )
if [ -z "${UUID}" ]
then
echo "Invalid mobileprovision file: ${1}" 1>&2
exit 2
else
echo "${UUID}"
fi