# Codesign a single-file JavaScript executable on macOS (/docs/guides/runtime/codesign-macos-executable)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 447 · updated: 2026-07-28 -->
Related: [Install TypeScript declarations for Bun](/docs/guides/runtime/typescript.md), [Re-map import paths](/docs/guides/runtime/tsconfig-paths.md), [Debugging Bun with the VS Code extension](/docs/guides/runtime/vscode-debugger.md), [Debugging Bun with the web debugger](/docs/guides/runtime/web-debugger.md), [Inspect memory usage using V8 heap snapshots](/docs/guides/runtime/heap-snapshot.md), [Build-time constants with --define](/docs/guides/runtime/build-time-constants.md)

Compile your executable using the `--compile` flag.

```sh
bun build --compile ./path/to/entry.ts --outfile myapp
```

***

List your available signing identities. You'll pass one of these to `codesign` in a later step. This command requires macOS.

```sh terminal icon="terminal"
security find-identity -v -p codesigning
```

```txt
1. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX "Developer ID Application: Your Name (ZZZZZZZZZZ)"
   1 valid identities found
```

***

Optional, but recommended: create an `entitlements.plist` file with the necessary permissions for the JavaScript engine to work correctly.

```xml entitlements.plist icon="file-code"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.disable-executable-page-protection</key>
    <true/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
</dict>
</plist>
```

***

Sign your executable using the `codesign` command and verify it works.

```bash terminal icon="terminal"
codesign --entitlements entitlements.plist -vvvv --deep --sign "XXXXXXXXXX" ./myapp --force
codesign -vvv --verify ./myapp
```

***

For more information on macOS codesigning, refer to [Apple's Code Signing documentation](https://developer.apple.com/documentation/security/code_signing_services). For details about creating single-file executables with Bun, see [Standalone Executables](/bundler/executables). This guide requires Bun v1.2.4 or newer.
