Skip to content

Commit 13daa72

Browse files
authored
FIX: macos build (#2300)
* FIX: macos build * FIX: format
1 parent 5f6074b commit 13daa72

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

launcher/afterPackMac.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { execSync } = require("child_process");
2+
const path = require("path");
3+
4+
// electron-builder v26 no longer re-signs bundled frameworks when no certificate is
5+
// provided. The Electron Framework ships pre-signed with the Electron project's Apple
6+
// Team ID, causing macOS 26+ to reject the load because the main executable has no
7+
// Team ID. Re-sign everything with ad-hoc ("-") so all binaries share a consistent
8+
// (empty) Team ID and dyld's validation passes.
9+
exports.default = async function afterPackMac(context) {
10+
if (context.electronPlatformName !== "darwin") return;
11+
12+
const appPath = path.join(context.appOutDir, `${context.packager.appInfo.productFilename}.app`);
13+
14+
console.log(`[afterPackMac] Ad-hoc re-signing for macOS 26+ Team ID compatibility:`);
15+
console.log(`[afterPackMac] ${appPath}`);
16+
17+
execSync(`codesign --force --deep --sign - "${appPath}"`, { stdio: "inherit" });
18+
19+
console.log(`[afterPackMac] Done.`);
20+
};

launcher/vue.config.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const shouldNotarize = process.env.NOTARIZE === "true";
2+
const isSigned = process.env.CSC_IDENTITY_AUTO_DISCOVERY !== "false";
23
module.exports = {
34
parallel: false,
45
pluginOptions: {
@@ -12,6 +13,7 @@ module.exports = {
1213
appId: "com.stereum.launcher",
1314
productName: "Stereum-Launcher",
1415
...(shouldNotarize ? { afterSign: "@sapien99/vue-cli-plugin-electron-builder-notarize" } : {}),
16+
...(!isSigned ? { afterPack: "./afterPackMac.js" } : {}),
1517
buildDependenciesFromSource: false,
1618
nodeGypRebuild: false,
1719
npmRebuild: false,
@@ -27,8 +29,16 @@ module.exports = {
2729
artifactName: "Stereum-Launcher-${version}.${ext}",
2830
},
2931
mac: {
30-
hardenedRuntime: true,
31-
entitlements: "./node_modules/@sapien99/vue-cli-plugin-electron-builder-notarize/entitlements.mac.inherit.plist",
32+
// hardenedRuntime requires consistent Team IDs across all binaries; only enable
33+
// when actually signing, otherwise the Electron Framework's pre-signed Team ID
34+
// differs from the unsigned main binary and dyld refuses to load it (macOS 14.4+)
35+
hardenedRuntime: isSigned,
36+
...(isSigned
37+
? {
38+
entitlements: "./node_modules/@sapien99/vue-cli-plugin-electron-builder-notarize/entitlements.mac.inherit.plist",
39+
entitlementsInherit: "./node_modules/@sapien99/vue-cli-plugin-electron-builder-notarize/entitlements.mac.inherit.plist",
40+
}
41+
: {}),
3242
gatekeeperAssess: false,
3343
artifactName: "Stereum-Launcher-${version}.${ext}",
3444
x64ArchFiles: "**/*.node",

0 commit comments

Comments
 (0)