diff --git a/lib/build.ts b/lib/build.ts index deb18232..85de5bc1 100644 --- a/lib/build.ts +++ b/lib/build.ts @@ -205,6 +205,14 @@ async function compileOnUnix( stdio: 'inherit', }); + if (targetPlatform === 'macos') { + // Newer versions of Apple Clang automatically ad-hoc sign the compiled executable. + // However, for final executable to be signable, base binary MUST NOT have an existing signature. + await spawn('codesign', ['--remove-signature', output], { + stdio: 'inherit', + }); + } + return output; }