Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Commit 4f1e120

Browse files
committed
build: strip signature from compiled macOS base binary
Newer versions of Apple Clang automatically ad-hoc sign the compiled executable, due to the new mandatory code signing requirement [1]. However, for final executable to be signable, base binary MUST NOT have an existing signature. This change strips the ad-hoc signature from compiled macOS base binary. [1]: https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-universal-apps-release-notes Refs: vercel/pkg#1164 Bug: vercel/pkg#1023
1 parent 25b257c commit 4f1e120

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/build.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ async function compileOnUnix(
205205
stdio: 'inherit',
206206
});
207207

208+
if (targetPlatform === 'macos') {
209+
// Newer versions of Apple Clang automatically ad-hoc sign the compiled executable.
210+
// However, for final executable to be signable, base binary MUST NOT have an existing signature.
211+
await spawn('codesign', ['--remove-signature', output], {
212+
stdio: 'inherit',
213+
});
214+
}
215+
208216
return output;
209217
}
210218

0 commit comments

Comments
 (0)