Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete expired provisioning profiles in Xcode

I want to delete expired provisioning profile manually but I don't want to delete all profiles. I want to add new provisioning profiles but in new Xcode 8.3.2, I can only see certificates and if I directly add provisioning profile by double click how can I check the date of provisioning profile.

like image 743
vp2698 Avatar asked Jun 22 '17 07:06

vp2698


Video Answer


2 Answers

This is the way to do it in XCode 9, I believe it is the same in XCode 8.3:

Mind that the certificates and the provisioning profiles are managed separately now, so it is safe to remove the provisioning profiles and download them again.

  1. First make sure to correct or remove the expired profiles in your developer account.
  2. Open the folder "~/Library/MobileDevice/Provisioning Profiles". It is a hidden folder, so use Finder => Go => Go to folder...
  3. Delete all provisioning profiles (move to trash).
  4. In XCode go to XCode => Preferences and select AppleID and team.
  5. Choose "Download Manual Profiles".

The valid profiles are downloaded and the expired profiles are gone.

like image 150
Marcel W Avatar answered Sep 19 '22 17:09

Marcel W


If you open the .mobileprovision files in something like TextEdit, you can view the expiration date of the profile. You can do this manually for all files in ~/Library/MobileDevice/Provisioning Profiles if you want, and manually delete the ones that expired already.

OR

You can use a script to check all the files in the Provisioning Profiles directory.

See this answer for more details about the script.

Note that the script will not do the delete as is (the rm command is commented out for safety), but in it's current state it will list each provisioning profile and whether it is expired or not. You can either delete the expired ones manually, or uncomment the rm command to have the script do it.

Fortunately, if you do delete one you need, you can always re-download the latest from Apple's developer site. I often will delete all the provisioning profiles and then just download the one(s) that is needed. Xcode can sometimes get confused if you have multiple valid profiles for an app you are building.

Honestly, at this point, if you are struggling with code signing and it isn't a multi-member team environment, you should look into doing automatic code signing. This gives Xcode the power to create / update certificates and profiles for you on each Mac.

like image 21
wottle Avatar answered Sep 20 '22 17:09

wottle