Skip to content

Instantly share code, notes, and snippets.

@d4r1091
Forked from benvium/installMobileProvisionFile.sh
Last active January 16, 2020 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d4r1091/e138162b2de7f0bc850f302ff573cf9e to your computer and use it in GitHub Desktop.
Save d4r1091/e138162b2de7f0bc850f302ff573cf9e to your computer and use it in GitHub Desktop.
This script installs a .mobileprovision file via bash (no GUI session needed) - Tested on zsh
#!/bin/sh
# 2012 - Ben Clayton (benvium). Calvium Ltd
# 2017 - Dario Carlomagno (d4r1091). Tictrac Ltd
#
# This script installs a .mobileprovision file without using Xcode. Unlike Xcode, it'll
# work over SSH.
#
# Requires Mac OS X (I'm using 10.7 and Xcode 4.3.2)
#
# Usage installMobileProvisionFile.sh path/to/foobar.mobileprovision
if [ ! $# == 1 ]; then
echo "Usage: $0 (path/to/mobileprovision)"
exit
fi
mp=$1
uuid=`echo $(security cms -D -i ${mp}) | sed -n "/UUID/ s/.*<string>\(.*\)<\/string>.*/\1/p"`
echo "Found UUID $uuid"
output="$HOME/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"
echo "creating provisioning profile directory if doesn't exists (Running on CD machine)"
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles/"
echo "copying to $output..."
cp -f "${mp}" "$output"
echo "done"
@d4r1091
Copy link
Author

d4r1091 commented Aug 27, 2019

Updated and currently working

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