electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

What is the correct method for building for macOS both Arm and Intel?

Open manngo opened this issue 9 months ago • 4 comments

  • 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?

manngo avatar Sep 06 '23 02:09 manngo

I use this in my build and it works fine to build for both Intel and Arm:

"target": [ { "target": "mas", "arch": "universal" } ]

mathias-berg avatar Oct 05 '23 18:10 mathias-berg

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.

github-actions[bot] avatar Dec 14 '23 00:12 github-actions[bot]

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}"
    },

cmdcolin avatar Dec 15 '23 14:12 cmdcolin

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.

github-actions[bot] avatar Feb 15 '24 00:02 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity.

github-actions[bot] avatar Apr 23 '24 00:04 github-actions[bot]