question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Plans to Support Apple Silicon builds?

See original GitHub issue

Are there current plans to support Apple Silicon builds with electron-builder? Weā€™re currently in the process of making sure our electron app is ready for ARM support, so I wanted to make sure that weā€™d be able to build to those targets using electron-builder.

If so, what does the release timeline look like for that?

Since https://github.com/electron-userland/electron-builder/issues/5095 was closed with no resolution, I figured it best to open a new issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:35
  • Comments:107 (6 by maintainers)

github_iconTop GitHub Comments

15reactions
mmaiettacommented, Nov 12, 2020

FWIW, I was able to build an arm64 electron example app with the help of patch-package on two files. Perhaps this will help/unblock people investigating further šŸ™‚

I was able to package via both yarn electron-builder to use package.json and cli yarn electron-builder --dir --arm64

Unfortunately, Iā€™m actually unable to test the app though as I donā€™t have a compatible MacOS version installed right now. Just to be verbose, hereā€™s the error alert

You canā€™t use this version of the application ā€œMyApp.appā€ with this version of macOS. You have macOS 10.15.7. The application requires macOS 11.0 or later.

Maybe someone would be willing to test this? šŸ˜‰


Here are the changes I made:

package.json excerpt:

"build": {
    "appId": "test",
    "mac": {
      "target" : { "target": "dir", "arch": "arm64" }
    }
  },
  "devDependencies": {
    "electron": "11.0.0-beta.20",
    "electron-builder": "^22.9.1"
  },

Patch 1: app-builder-lib+22.9.1.patch

diff --git a/node_modules/app-builder-lib/out/macPackager.js b/node_modules/app-builder-lib/out/macPackager.js
index 4825f78..2aa682b 100644
--- a/node_modules/app-builder-lib/out/macPackager.js
+++ b/node_modules/app-builder-lib/out/macPackager.js
@@ -258,7 +258,7 @@ class MacPackager extends _platformPackager().PlatformPackager {
 
     if (!hasMas || targets.length > 1) {
       const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged;
-      nonMasPromise = (prepackaged ? Promise.resolve() : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName, arch, this.platformSpecificBuildOptions, targets)).then(() => this.packageInDistributableFormat(appPath, _builderUtil().Arch.x64, targets, taskManager));
+      nonMasPromise = (prepackaged ? Promise.resolve() : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName, arch, this.platformSpecificBuildOptions, targets)).then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager));
     }
 
     for (const target of targets) {

Patch 2: electron-builder+22.9.1.patch

diff --git a/node_modules/electron-builder/out/builder.js b/node_modules/electron-builder/out/builder.js
index 59383a1..8b9aef7 100644
--- a/node_modules/electron-builder/out/builder.js
+++ b/node_modules/electron-builder/out/builder.js
@@ -69,10 +69,6 @@ function normalizeOptions(args) {
 
   function processTargets(platform, types) {
     function commonArch(currentIfNotSpecified) {
-      if (platform === _appBuilderLib().Platform.MAC) {
-        return args.x64 || currentIfNotSpecified ? [_builderUtil().Arch.x64] : [];
-      }
-
       const result = Array();
 
       if (args.x64) {
@@ -242,7 +238,7 @@ function createTargets(platforms, type, arch) {
   const targets = new Map();
 
   for (const platform of platforms) {
-    const archs = platform === _appBuilderLib().Platform.MAC ? [_builderUtil().Arch.x64] : arch === "all" ? [_builderUtil().Arch.x64, _builderUtil().Arch.ia32] : [(0, _builderUtil().archFromString)(arch == null ? process.arch : arch)];
+    const archs = arch === "all" && platform !== _appBuilderLib().Platform.MAC ? [_builderUtil().Arch.x64, _builderUtil().Arch.ia32] : [(0, _builderUtil().archFromString)(arch == null ? process.arch : arch)];
     const archToType = new Map();
     targets.set(platform, archToType);
 

11reactions
ahmadwaliesipickcommented, Nov 5, 2020

any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apple announces Mac transition to Apple silicon
Apple plans to ship the first Mac with Apple silicon by the end of the year and complete the transition in about two...
Read more >
Apple Silicon: The Complete Guide - MacRumors
This guide covers everything we know about Apple silicon, Apple's plans to transition the entire Mac lineup away from Intel chips,Ā ...
Read more >
Plans for an Apple Silicon build? | Ultra Fractal Forum
Are there plans to do a build for the new Apple M1 processors? I imagine it would be a lot faster for those...
Read more >
Apple Silicon: Why developers don't need to worry about the ...
Apple Silicon, built on ARM architecture, is going to be ... Also, Apple said it plans to support Intel-based Macs for years to...
Read more >
Mac transition to Apple silicon - Wikipedia
The Mac transition to Apple silicon is the process of changing the central processing units (CPUs) of Apple Inc.'s line of Mac computers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found