Hello,
I'm running into an issue when code signing my .app
file on macOS. After introducing the --entitlements
flag, I'm encountering an error that prevents the app from launching:
Error Messages:
- App UI: "Cannot open the file"
- Terminal (using
open file.app
)
The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x60000216d620 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}
Troubleshooting Details:
- Without code signing, the app launches and permission pop-ups function correctly (the file tauri generates).
- With code signing (but without
--entitlements
), the app launches but there are no permission pop-ups. - All scenarios (without signing, with signing, with signing +
--entitlements
) all have Info.plist in the/Contents
of the.app
file - Notarizing and stapling works fine when I do not include the
--entitlements
flag when signing. - Code for signing with entitlements:
codesign --timestamp --sign "Developer ID Application: ()" --options=runtime --entitlements ./src-tauri/Info.plist "${APP_FILE}"
Specifications
- MacBook Air, M2, 16GB
- macOS Sonoma 14.3.1
- Xcode 15.2 (Build version 15C500b)
The most common reason for this is that you’re using a restricted entitlement that’s not authorised by your profile. I talk about this in some detail in Resolving Trusted Execution Problems. A good place to start is to run syspolicy_check
against your app.
When it comes to fixing this, I have two posts that explain how to sign code by hand:
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"