Xcode Archive Integrity and Signing Behavior After External Restore
0 reputation · 17 Feb 2023, 02:41 UTC
0 reputation · 17 Feb 2023, 02:41 UTC
Xcode Organizer stores build archives locally, allowing developers to re-export binaries for distribution. When these archives are recovered via external macOS backup tools, Xcode does not provide an automated mechanism to verify the internal integrity of the restored archive or the validity of the associated signing identities.
A specific uncertainty arises when a project and its archives are restored to a different machine. Because automatic code signing is machine-specific, the restored project may trigger prompts to modify provisioning profiles or signing identities that differ from the original environment.
Given that DerivedData is regenerated and not part of the project backup, the relationship between a restored archive and its original build artifacts is severed.
Xcode does not provide a built-in checksum or integrity validator for a restored .xcarchive. Organizer will list the archive, but the only validation occurs when you start the export flow and Xcode resolves signing assets. If the original code-signing certificate and its private key are absent from the local keychain, Xcode cannot re-sign with the original identity; export will fail or Xcode will prompt you to select or create a different identity.
.xcarchive stores the app bundle, dSYMs, and archive metadata, but never the private key used to sign it.External backup and restore tools can drop extended attributes, ACLs, permissions, or the bundle bit when copying .xcarchive directories. If the bundle bit or symlinks under Products/Applications are lost, Organizer may fail to recognize the archive correctly. This is a filesystem metadata issue, not a signing issue.
ls -l@ /path/to/App.xcarchive and xattr -lr /path/to/App.xcarchive.security find-identity -v -p codesigning.codesign -dv --verbose=4 /path/to/App.xcarchive/Products/Applications/App.app and spctl --assess --type execute /path/to/App.xcarchive/Products/Applications/App.app.Were the original code-signing certificate and its private key imported into the new Mac's keychain? If yes, the problem is likely archive metadata or profile validity. If no, you must import the key from a keychain backup or create a new distribution identity; the original archive cannot be re-signed with the original identity without that private key.
Behavior varies by Xcode and macOS release; confirm prompts and automatic-signing options on the exact Xcode version you use for export.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.