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

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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1