title: How to completely, dependably remove provisioning profiles from Mac?
body: <p>Ok so i am trying to set up an automated build and signing/packaging of iOS app (continuous integration, you know). Our pool of testers (i.e. UDIDs) is not very stable, so our provision profiles tend to change quite often. To be completely sure that i build with the latest profile (and avoid the common caching pitfalls), i want to clean the buildbox of all previous profiles and download fresh ones from Apple provisioning portal before each build. I seem to be unable to achieve the first step deterministically. I cleaned <code>~/Library/MobileDevice/Provisioning Profiles/</code> but XCode still was taking the profiles from somewhere. I cleaned XCode Organizer, in Library ase well as all currently attached devices. Mind that i need to avoid this step, unless there is a known way how to do it from command line! Nevertheless, XCode still was signing happily. In desperation, i did <code>find / -name "*.mobileprovision"</code> and found copies in no less than 3 temporary-ish locations:</p>
  
  <ul>
  <li><code>~/Library/Developer/XCode/DerivedData/[ProjectName]-[hash]/</code></li>
  <li><code>~/Library/Developer/XCode/Archives/[date]/[Projectname].xcarchive/Products/Applications/[Projectname].app/</code></li>
  <li><code>/private/var/folders/k_/[hash]/T/[UUID]/[Projectname].app/</code></li>
  </ul>
  
  <p>After deleting all of them, XCode finally admitted there are no profiles (just listing certificates as understandable "Identities without Profiles") and failed in signing.</p>
  
  <p>Is there any determinism in the cleaning? I might be able to figure out the two first paths, but there is no chance with the third one, having two random sequences in it. Did i miss something? Can i depend on XCode using a new profile, if i just delete the old ones from <code>~/Library/MobileDevice/Provisioning Profiles/</code> ? I would like to avoid spinning off a complete new MacOS VM every time, just to be sure about that :)</p>
  
  <p>For completeness, we are using anything between XCode 4.3 and 4.5, can sync on latest 4.6 if it makes a difference. But i doubt it.</p>