How to package an electron app for "darwin-x64" on an Mac M1/Apple Silicone (arm64)?
Asked Answered
C

3

7

Hi Electron Enthusiasts! How do I package an electron app for "darwin-x64" on an Mac M1/Apple Silicone (arm64)?

It is definitely possible, since a month ago I had an MacBookPro with M1 chip and I was using electron forge to package. The final product was a "darwin-x64" app. It showed up as "kind=intel" in Activity Monitor when executed and I shared the app with colleagues running good old intel macs. They were able to run it without any problems. Now I am on a new MacBookPro with M1 and I had to reinstall everything. Now electron forge outputs a 100% "arm64" version of my app. Which is perfect but I also have to package an intel version on this machine. I was searching on google for hours without any luck. So any help highly appreciated!

My electron forge config does NOT accept:

module.exports = {
  "packagerConfig": {
    "all": true, 
    "arch": "x64",
  }
}

What am I missing?

Cataplasia answered 7/2, 2022 at 20:36 Comment(0)
Y
5

You can use the following command with Universal architecture with electron forge as https://github.com/electron/universal is now available.

npm run make -- --arch=universal --platform=darwin

This simply builds for both mac versions and doubles the size of your app.

Yorgen answered 29/1, 2023 at 21:52 Comment(0)
B
4

This worked for me:

electron-forge package --arch=x64 --platform=darwin

electron-forge doesn't accept all in packagerConfig and ignores arch and platform inside it too for some reason.

Brassiere answered 8/5, 2022 at 4:4 Comment(0)
I
1

This also worked for me: npx electron-builder --dir --mac --universal

Invigilate answered 23/8, 2022 at 1:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.