electron-builder
electron-builder copied to clipboard
What is the correct method for building for macOS both Arm and Intel?
- Electron-Builder Version: 23.3.2
- Node Version: 20.1.0
- Electron Version: 18.3.5
- Target: macOS
I am trying to build for macOS Arm & Intel.
If I use the following:
npx electron-builder -m --x64 --arm64 --publish never
it appears to work.
In the past, I used:
npm run dist
That also works, but only for the current platform (M1 Mac).
I read somewhere that adding platforms in the arch
setting in package.json
should work, but it doesn’t like the arch
setting, as far as I can see.
What is the preferred method?
I use this in my build and it works fine to build for both Intel and Arm:
"target": [ { "target": "mas", "arch": "universal" } ]
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
My whole electron builder configuration looks as follows for this
https://github.com/GMOD/jbrowse-components/blob/223d8bfb68fd1bacaf22852639ad5920f1b7f43b/products/jbrowse-desktop/package.json#L113-L174
importantly for mac I had to set the universal target on both zip and dmg (we release just dmg not mac app store currently) and the zip was needed to make the dmg able to auto-update. mergeASARs seemed to be needed also, can't quite recall why, but that's what we got working. the binary sizes are a bit large maybe as a result(?) but it works on both m1 macs and regular intel
"mac": {
"mergeASARs": false,
"target": [
{
"target": "dmg",
"arch": [
"universal"
]
},
{
"target": "zip",
"arch": [
"universal"
]
}
],
"publish": [
"github"
],
"category": "public.app-category.utilities",
"artifactName": "jbrowse-desktop-v${version}-mac.${ext}"
},
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.