codex - 💡(How to fix) Fix macOS npm alpha 0.125.0-alpha.1 is killed by AMFI due to new keychain entitlements [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19335Fetched 2026-04-25 06:11:26
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Author
Timeline (top)
commented ×2labeled ×2closed ×1

Error Message

amfid: Restricted entitlements not validated, bailing out. Error: Error Domain=AppleMobileFileIntegrityError Code=-413 "No matching profile found" amfid: .../codex not valid: Error Domain=AppleMobileFileIntegrityError Code=-413 "No matching profile found" kernel: AMFI: bailing out because of restricted entitlements. kernel: Code has restricted entitlements, but the validation of its code signature failed. kernel: proc ...: load code signature error 4 for file "codex"

Root Cause

macOS logs point to AMFI rejecting the binary because of restricted entitlements:

Fix Action

Fix / Workaround

Local workaround:

After ad-hoc re-signing, codex --version, codex --help, and codex --yolo launch normally. That removes the restricted entitlements locally, so it is only a workaround. The likely fix is to avoid applying restricted keychain access-group entitlements to standalone npm CLI binaries unless the release signing/provisioning path validates them for direct execution.

Code Example

npm install -g @openai/codex@alpha

---

/opt/homebrew/lib
└── @openai/codex@0.125.0-alpha.1

---

Darwin 25.2.0 arm64 arm

---

zsh -lc 'codex --version; printf "exit=%s\n" "$?"'
# exit=137

---

zsh -lc '/opt/homebrew/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex --version; printf "exit=%s\n" "$?"'
# exit=137

---

amfid: Restricted entitlements not validated, bailing out. Error: Error Domain=AppleMobileFileIntegrityError Code=-413 "No matching profile found"
amfid: .../codex not valid: Error Domain=AppleMobileFileIntegrityError Code=-413 "No matching profile found"
kernel: AMFI: bailing out because of restricted entitlements.
kernel: Code has restricted entitlements, but the validation of its code signature failed.
kernel: proc ...: load code signature error 4 for file "codex"

---

com.apple.application-identifier = 2DC432GLL2.com.openai.codex
com.apple.developer.team-identifier = 2DC432GLL2
com.apple.security.cs.allow-jit = true
keychain-access-groups = [2DC432GLL2.com.openai.codex]

---

npm install -g @openai/codex@alpha

---

codex --version

---

/usr/bin/log show --last 30m --style compact --predicate '(eventMessage CONTAINS[c] "No matching profile found" OR eventMessage CONTAINS[c] "restricted entitlements" OR eventMessage CONTAINS[c] "load code signature error 4")'

---

# 0.124.0 Darwin arm64 artifact
codex-cli 0.124.0
exit_124=0

# 0.125.0-alpha.1 Darwin arm64 artifact
exit_125=137

---

6e32ee4f294afd0eb897f695b71fa56a7ce1d0949a44317ac3ef0e6eaeb16228

---

<key>com.apple.security.cs.allow-jit</key>
<true/>

---

<key>com.apple.application-identifier</key>
<string>2DC432GLL2.com.openai.codex</string>
<key>com.apple.developer.team-identifier</key>
<string>2DC432GLL2</string>
<key>keychain-access-groups</key>
<array>
  <string>2DC432GLL2.com.openai.codex</string>
</array>

---

codesign --force --sign - /opt/homebrew/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.125.0-alpha.1

Installed via:

npm install -g @openai/codex@alpha

npm ls -g --depth=0 @openai/codex reports:

/opt/homebrew/lib
└── @openai/[email protected]

What subscription do you have?

N/A. The binary is killed before auth, config, model selection, or startup can run.

Which model were you using?

N/A. The binary is killed before startup.

What platform is your computer?

Darwin 25.2.0 arm64 arm

What terminal emulator and version are you using, if applicable?

Reproduces outside the interactive TUI path. I reproduced it through zsh, the npm launcher, and direct invocation of the platform binary. The process exits before terminal-specific behavior matters.

What issue are you seeing?

After updating to the latest npm alpha, codex is killed immediately on macOS. Even lightweight commands like codex --version and codex --help fail before printing anything.

Shell-level reproduction shows exit 137:

zsh -lc 'codex --version; printf "exit=%s\n" "$?"'
# exit=137

The same happens when invoking the Darwin arm64 platform binary directly:

zsh -lc '/opt/homebrew/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex --version; printf "exit=%s\n" "$?"'
# exit=137

macOS logs point to AMFI rejecting the binary because of restricted entitlements:

amfid: Restricted entitlements not validated, bailing out. Error: Error Domain=AppleMobileFileIntegrityError Code=-413 "No matching profile found"
amfid: .../codex not valid: Error Domain=AppleMobileFileIntegrityError Code=-413 "No matching profile found"
kernel: AMFI: bailing out because of restricted entitlements.
kernel: Code has restricted entitlements, but the validation of its code signature failed.
kernel: proc ...: load code signature error 4 for file "codex"

The signed 0.125.0-alpha.1 Darwin arm64 binary contains these entitlements:

com.apple.application-identifier = 2DC432GLL2.com.openai.codex
com.apple.developer.team-identifier = 2DC432GLL2
com.apple.security.cs.allow-jit = true
keychain-access-groups = [2DC432GLL2.com.openai.codex]

By comparison, the previous Darwin arm64 artifacts I checked only carry com.apple.security.cs.allow-jit.

What steps can reproduce the bug?

  1. On macOS arm64, install the current alpha:

    npm install -g @openai/codex@alpha
  2. Run:

    codex --version
  3. Observe the process being killed with exit 137.

  4. Check system logs:

    /usr/bin/log show --last 30m --style compact --predicate '(eventMessage CONTAINS[c] "No matching profile found" OR eventMessage CONTAINS[c] "restricted entitlements" OR eventMessage CONTAINS[c] "load code signature error 4")'

I also ruled out local config by running the unpacked npm artifacts with a clean environment and temp HOME / CODEX_HOME:

# 0.124.0 Darwin arm64 artifact
codex-cli 0.124.0
exit_124=0

# 0.125.0-alpha.1 Darwin arm64 artifact
exit_125=137

The 0.125.0-alpha.1 installed binary and the clean npm tarball binary have the same SHA256:

6e32ee4f294afd0eb897f695b71fa56a7ce1d0949a44317ac3ef0e6eaeb16228

What is the expected behavior?

codex --version, codex --help, and the interactive CLI should launch normally after installing @openai/codex@alpha from npm.

Additional information

This looks related to PR #19167, ci: add macOS keychain entitlements, which changed .github/actions/macos-code-sign/codex.entitlements.plist from only:

<key>com.apple.security.cs.allow-jit</key>
<true/>

to also include:

<key>com.apple.application-identifier</key>
<string>2DC432GLL2.com.openai.codex</string>
<key>com.apple.developer.team-identifier</key>
<string>2DC432GLL2</string>
<key>keychain-access-groups</key>
<array>
  <string>2DC432GLL2.com.openai.codex</string>
</array>

That change is present in rust-v0.125.0-alpha.1, and the 0.125.0-alpha.1 npm Darwin arm64 artifact is the first artifact I found where the standalone CLI binary has those restricted entitlements.

This is adjacent to #17447, but appears to be a narrower npm alpha regression rather than the Homebrew cask/quarantine/provenance issue described there.

Local workaround:

codesign --force --sign - /opt/homebrew/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex

After ad-hoc re-signing, codex --version, codex --help, and codex --yolo launch normally. That removes the restricted entitlements locally, so it is only a workaround. The likely fix is to avoid applying restricted keychain access-group entitlements to standalone npm CLI binaries unless the release signing/provisioning path validates them for direct execution.

extent analysis

TL;DR

The issue can be temporarily resolved by re-signing the binary using codesign to remove restricted entitlements.

Guidance

  • The error is caused by AMFI rejecting the binary due to restricted entitlements, as indicated by the system logs showing "No matching profile found" and "load code signature error 4".
  • The codesign command can be used to re-sign the binary and remove the restricted entitlements, allowing the codex command to run normally.
  • The re-signing process can be done using the command codesign --force --sign - /opt/homebrew/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex.
  • To verify the fix, run codex --version or codex --help after re-signing the binary to ensure it launches normally.

Example

codesign --force --sign - /opt/homebrew/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex

Notes

  • This is a temporary workaround and not a permanent fix, as it removes the restricted entitlements locally.
  • The underlying issue is related to the addition of keychain entitlements in PR #19167, which changed the .github/actions/macos-code-sign/codex.entitlements.plist file.

Recommendation

Apply the workaround by re-signing the binary using codesign, as this will allow the codex command to run normally until a permanent fix is available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING