To fix production build crash issues on macOS because of:
- GPU loading
- Network loading
- Keychain API inaccessible
- Other crash error from Electron Chromium on macOS
To note and help someone get crash error in Electron macOS production builds (all run well in development mode).
- Check Application "entitlements.plist" file by `codesign -d --entitlements - --xml {.app path}`
- Check every entry in that file if it needed, in common case, this `entitlements.plist` will work.
com.apple.security.cs.allow-jit
com.apple.security.device.audio-input
com.apple.security.device.bluetooth
com.apple.security.device.camera
com.apple.security.device.print
com.apple.security.device.usb
com.apple.security.personal-information.location
]]>
Example additional entries to enable Keychain API:
com.apple.security.cs.allow-unsigned-executable-memory
com.apple.security.cs.disable-executable-page-protection
com.apple.security.cs.disable-library-validation
keychain-access-groups
{your application-identifier}
]]>
Disable Electron Builder signing step (set env CSC_IDENTITY_AUTO_DISCOVERY=false
), add script "after-sign.js" and configure Electron Builder to call it to do:
- Signing steps
- Notarize app
- Create final DMG file
Add mac config to Electron Builder to include keychain groups defined in entitlements.plist
conf.mac.extendInfo = {
"keychain-access-groups": [
`{your application-identifier}`,
]
}
Script "after-sign.js:
Hope you found this useful!