Fix Broken macOS App Bundles
Diagnose and fix .app bundles that fail to launch due to Gatekeeper, quarantine, or broken code signatures. Common with apps distributed outside the Mac App Store.
Diagnose with xattr -l, codesign -dv --verbose=2, spctl --assess, and file on the binary. Then apply fixes in order, testing launch after each:
- Clear quarantine:
xattr -cr /path/to/App.app - Re-sign ad-hoc:
codesign --force --deep --sign - /path/to/App.app
Critical Pitfalls
- Never just remove a signature (
codesign --remove-signature) without re-signing. macOS refuses to launch unsigned binaries (POSIX error 153). - Clear quarantine before re-signing. Quarantine can interfere with the signing process.