How to notarize electron app
Issue #430
Use electron builder
1 | npm install electron-builder@latest --save-dev |
- Prefer electron-builder over electron-packager
- Configuration https://www.electron.build/configuration/configuration
package.json
1 | { |
Declare entitlements
entitlements.plist
1 |
|
Use electron-notarize
afterSignHook.js
1 | const fs = require('fs'); |
Run
Generate password for Apple Id because of 2FA
1 | export appleId=onmyway133@gmail.com |
Check
1 | spctl --assess --verbose Icon\ Generator.app |
Troubleshooting
babel
- Since electron-builder create
dist
folder for distribution, for exampledist/mac/Icon Generator
, I’ve renamed babel generated code tobabel
directory
babel 6 regeneratorRuntime is not defined
It is because of afterSignHook. Ignore in .babelrc
not work
1 | { |
Should use babel 7 with babel.config.js
1 | npm install --save @babel/runtime |
Use electron-forge
https://httptoolkit.tech/blog/notarizing-electron-apps-with-electron-forge/