1

I followed this question: Provide xcodebuild with .mobileprovision file and used the script provided in the answer to try and copy .mobileprovision files into the directory, the only difference is I replaced the mParse dependency using grep, as per a suggestion in this link: https://gist.github.com/benvium/2568707

However, when I run this script I get the following error:

$ sh installMobileProvisionFile.sh BuilderTestNew.mobileprovision 
Found UUID 402a766e-bfc7-4f16-8ab6-a46a95361b00
copying to ~/Library/MobileDevice/Provisioning Profiles/402a766e-bfc7-4f16-8ab6-a46a95361b00.mobileprovision..
cp: ~/Library/MobileDevice/Provisioning Profiles/402a766e-bfc7-4f16-8ab6-a46a95361b00.mobileprovision: No such file or directory
done

If I just run the cp command executed in the script by myself replacing the variables for the above values it works normally, so I can't understand why it fails when using this script? I am on Yosemite by the way.

EDIT:

Here's the adapted script:

if [ ! $# == 1 ]; then
 echo "Usage: $0 (path/to/mobileprovision)"
exit
fi

mp=$1

uuid=`grep UUID -A1 -a ${mp}| grep -io "[-A-Z0-9]\{36\}"`

echo "Found UUID $uuid"

output="~/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"

echo "copying to $output.."
cp "${mp}" "$output"

echo "done"`
Community
  • 1
  • 1
Marcelo Risoli
  • 792
  • 7
  • 24
  • It looks like your cp is only passing a single argument. Am I crazy? It would definitely help to see your modified script. – Dan Apr 28 '15 at 14:33
  • Nope, the command line argument gets passed to the cp command normally, it seems to be a problem with the double quotes as they make the mobileprovision file a part of the path. – Marcelo Risoli Apr 28 '15 at 14:38
  • What do you see when you echo your source and target variables? – Dan Apr 28 '15 at 14:39
  • The output variable is there `~/Library/MobileDevice/Provisioning Profiles/402a766e-bfc7-4f16-8ab6-a46a95361b00.mobileprovision`, as for the source variable it prints the file name `BuilderTestNew.mobileprovision` as expected – Marcelo Risoli Apr 28 '15 at 14:42
  • Is your source provisioning profile in the same directory as your script? Sorry - going through the motions. ;) – Dan Apr 28 '15 at 14:44
  • Yes, it is placed in the same directory – Marcelo Risoli Apr 28 '15 at 14:49

1 Answers1

4

When using the cp command in Bash you need to provide the full path of the files. Aliases such as ~/myFolder won't work. You will need to provide a full path such as /Users/Me/myFolder.

Dan
  • 5,153
  • 4
  • 31
  • 42