diff --git a/.changeset/new-shirts-invent.md b/.changeset/new-shirts-invent.md new file mode 100644 index 00000000000..bef705638c9 --- /dev/null +++ b/.changeset/new-shirts-invent.md @@ -0,0 +1,5 @@ +--- +"electron-updater": patch +--- + +fix: use `uname -a` to get arch instead of 'process.arch' in mac silicon diff --git a/packages/electron-updater/src/MacUpdater.ts b/packages/electron-updater/src/MacUpdater.ts index 30cf4323b26..7d95b8fd45c 100644 --- a/packages/electron-updater/src/MacUpdater.ts +++ b/packages/electron-updater/src/MacUpdater.ts @@ -50,7 +50,18 @@ export class MacUpdater extends AppUpdater { log.warn(`sysctl shell command to check for macOS Rosetta environment failed: ${e}`) } - const isArm64Mac = process.arch === "arm64" || isRosetta + let isArm64Mac = false + try { + this.debug("Checking for arm64 in uname") + const result = execFileSync("uname", ['-a'], { encoding: "utf8" }) + const isArm = result.includes('ARM') + log.info(`Checked 'uname -a': arm64=${isArm}`) + isArm64Mac = isArm64Mac || isArm + } catch (e) { + log.warn(`uname shell command to check for arm64 failed: ${e}`) + } + + isArm64Mac = isArm64Mac || process.arch === 'arm64' || isRosetta // allow arm64 macs to install universal or rosetta2(x64) - https://github.com/electron-userland/electron-builder/pull/5524 const isArm64 = (file: ResolvedUpdateFileInfo) => file.url.pathname.includes("arm64") || file.info.url?.includes("arm64")