Skip to content

Instantly share code, notes, and snippets.

Created May 1, 2012 15:14
  • Star 31 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
This script installs a .mobileprovision file via bash (no GUI session needed)
# 2012 - Ben Clayton (benvium). Calvium Ltd
# Found at
# 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)
# IMPORTANT NOTE: You need to download and install the mpParse executable from
# and place it in the same folder as this script for this to work.
# Usage path/to/foobar.mobileprovision
if [ ! $# == 1 ]; then
echo "Usage: $0 (path/to/mobileprovision)"
uuid=`./mpParse -f ${mp} -o uuid`
echo "Found UUID $uuid"
output="~/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"
echo "copying to $output.."
cp "${mp}" "$output"
echo "done"
Copy link

webdevbyjoss commented Aug 2, 2018

Managed to do this on pure bash by using the following:

uuid=`echo $(security cms -D -i ${mp} | sed -n "/UUID/ s/.*<string>\(.*\)<\/string>.*/\1/p"`

Copy link

dougmarcey commented Aug 30, 2019

Another "pure bash" option that handles the lowercase uuids:

uuid=`security cms -D -i  | grep -aA1 UUID | grep -o "[-a-zA-Z0-9]\{36\}"`

Copy link

@dougmarcey Your proposal worked for me but the first portion of the command gives "cms: option requires an argument -- i" error.

I guess, you have forgotten to add $mp parameter. I modified the line as below,

uuid=`security cms -D -i ${mp} | grep -aA1 UUID | grep -o "[-a-zA-Z0-9]\{36\}"`

which works like a charm. 🙂 Thanks for the effort.

Copy link

I had problems with the "~", but worked replacing with "$HOME".

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