Diagnosed Claude CLI failure due to code signature.
UnderstandRe-signed binary to fix CLI issue.
EditConfirmed CLI works after fix.
VerifyReviewed user's project and reference site for gap analysis.
Understandwhy is my claude not working in my terminal? fix it
💸 Sponsored by AI Miles — Ramp · save time & money
Investigating why the claude CLI fails in your terminal — I'll run diagnostics and check how it's installed.
{
"success": true,
"finalTodos": [
{
"content": "Diagnose claude CLI failure in terminal",
"status": "in_progress",
"id": "1"
},
{
"content": "Apply fix based on root cause",
"status": "pending",
"id": "2"
},
{
"content": "Verify claude works after fix",
"status": "pending",
"id": "3"
}
]
}>which claude 2>&1; echo "---"; type claude 2>&1; echo "---"; claude --version 2>&1; echo "exit: $?"{
"output": "/Users/gaganarora/.local/bin/claude\n---\nclaude is /Users/gaganarora/.local/bin/claude\n---\n",
"exitCode": 137,
"rejected": false,
"notInterrupted": true
}>echo "PATH=$PATH"; echo "---"; ls -la ~/.local/bin/claude 2>&1; ls -la /usr/local/bin/claude 2>&1; ls -la ~/.claude/local/claude 2>&1{
"output": "PATH=/Users/gaganarora/.antigravity/antigravity/bin:/Users/gaganarora/.bun/bin:/Users/gaganarora/.bun/bin:/Users/gaganarora/.local/bin:/Users/gaganarora/.antigravity/antigravity/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Cursor.app/Contents/Resources/app/node_modules/@vscode/ripgrep/bin:/Users/gaganarora/.antigravity/antigravity/bin:/Users/gaganarora/.bun/bin:/Users/gaganarora/.local/bin:/Users/gaganarora/.cargo/bin:/Users/gaganarora/.orbstack/bin:/Users/gaganarora/.orbstack/bin\n---\nlrwxr-xr-x@ 1 gaganarora staff 54 Jun 19 12:05 /Users/gaganarora/.local/bin/claude -> /Users/gaganarora/.local/share/claude/versions/2.1.183\nls: /usr/local/bin/claude: No such file or directory\n",
"exitCode": 1,
"rejected": false,
"notInterrupted": true
}>claude 2>&1 | head -50; echo "exit: $?"{
"exitCode": 137,
"rejected": false,
"notInterrupted": true
}claude is installed but exits with code 137 (killed) — likely sandbox-related. Re-running outside the sandbox to capture the real error.
>claude --version 2>&1; echo "exit: $?"{
"exitCode": 137,
"rejected": false,
"notInterrupted": true
}>file /Users/gaganarora/.local/share/claude/versions/2.1.183; ls -la /Users/gaganarora/.local/share/claude/versions/ 2>&1{
"output": "/Users/gaganarora/.local/share/claude/versions/2.1.183: Mach-O 64-bit executable arm64\ntotal 1296120\ndrwxr-xr-x 8 gaganarora staff 256 Jun 19 14:22 .\ndrwxr-xr-x 3 gaganarora staff 96 Jan 27 15:47 ..\n-rwxr-xr-x@ 1 gaganarora staff 223390752 Jun 19 14:12 2.1.173\n-rw-r--r--@ 1 gaganarora staff 15928 Jun 19 14:12 2.1.173.kickbacks-manifest.json\n-rwxr-xr-x@ 1 gaganarora staff 224216352 Jun 19 14:13 2.1.175\n-rw-r--r--@ 1 gaganarora staff 15928 Jun 19 14:13 2.1.175.kickbacks-manifest.json\n-rwxr-xr-x@ 1 gaganarora staff 215952608 Jun 19 14:13 2.1.183\n-rw-r--r--@ 1 gaganarora staff 15928 Jun 19 14:13 2.1.183.kickbacks-manifest.json\n",
"rejected": false,
"notInterrupted": true
}>cat ~/.zshrc 2>/dev/null | grep -i claude; echo "---"; cat ~/.zprofile 2>/dev/null | grep -i claude; echo "---"; cat ~/.bash_profile 2>/dev/null | grep -i claude{
"exitCode": 1,
"rejected": false,
"notInterrupted": true
}Exit code 137 (SIGKILL) even outside the sandbox — investigating quarantine, code signing, and whether older versions run.
>xattr -l /Users/gaganarora/.local/share/claude/versions/2.1.183 2>&1; echo "---"; codesign -vv /Users/gaganarora/.local/share/claude/versions/2.1.183 2>&1; echo "---"; spctl -a -vv -t execute /Users/gaganarora/.local/share/claude/versions/2.1.183 2>&1{
"output": "com.apple.provenance: \u0001\u0002\n---\n/Users/gaganarora/.local/share/claude/versions/2.1.183: invalid signature (code or signature have been modified)\nIn architecture: arm64\n",
"exitCode": 1,
"rejected": false,
"notInterrupted": true
}>/Users/gaganarora/.local/share/claude/versions/2.1.175 --version 2>&1; echo "175 exit: $?"; /Users/gaganarora/.local/share/claude/versions/2.1.173 --version 2>&1; echo "173 exit: $?"{
"exitCode": 137,
"rejected": false,
"notInterrupted": true
}>dmesg 2>/dev/null || log show --last 2m --predicate 'eventMessage CONTAINS "claude"' 2>&1 | tail -20{
"output": "(eval):log:1: too many arguments\n",
"exitCode": 1,
"rejected": false,
"notInterrupted": true
}The Claude binary has an invalid signature. macOS is blocking execution because the code or signature has been modified.
Invalid code signature is causing macOS to kill the binary. Checking the install method and reinstalling.
>xattr -l /Users/gaganarora/.local/share/claude/versions/2.1.173 2>&1; codesign -vv /Users/gaganarora/.local/share/claude/versions/2.1.173 2>&1{
"output": "com.apple.provenance: \u0001\u0002\n/Users/gaganarora/.local/share/claude/versions/2.1.173: invalid signature (code or signature have been modified)\nIn architecture: arm64\n",
"exitCode": 1,
"rejected": false,
"notInterrupted": true
}Matches: 4
Files: 4
Pattern: claude.*install|install.*claude
Top files:
- platform/docs/specs/37-cloud-e2e-proof.md (1)
- platform/docs/adrs/0068-subscription-first-agent-auth.md (1)
- AGENTS.md (1)
- platform/docs/specs/38-cloud-default-posture.md (1)>ls -la ~/.local/share/claude/ 2>&1; cat ~/.local/share/claude/config.json 2>&1; ls -la ~/.claude/ 2>&1 | head -20{
"output": "total 0\ndrwxr-xr-x 3 gaganarora staff 96 Jan 27 15:47 .\ndrwxr-xr-x 9 gaganarora staff 288 May 8 09:45 ..\ndrwxr-xr-x 8 gaganarora staff 256 Jun 19 14:22 versions\ncat: /Users/gaganarora/.local/share/claude/config.json: No such file or directory\n",
"exitCode": 1,
"rejected": false,
"notInterrupted": true
}All versions have invalid signatures.
>npm list -g @anthropic-ai/claude-code 2>&1; which npm; npm view @anthropic-ai/claude-code version 2>&1{
"output": "npm warn Unknown env config \"devdir\". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.\n/opt/homebrew/lib\n`-- (empty)\n\nnpm notice\nnpm notice New minor version of npm available! 11.11.1 -> 11.17.0\nnpm notice Changelog: https://github.com/npm/cli/releases/tag/v11.17.0\nnpm notice To update run: npm install -g npm@11.17.0\nnpm notice\n",
"exitCode": 1,
"rejected": false,
"notInterrupted": true
}{
"references": [
{
"title": "Web search results",
"chunk": "Links:\n1. [BUG] Claude CLI killed by kernel on macOS 26 beta - obsolete code signature format · Issue #20407 · anthropics/claude-code\n2. Advanced setup\n3. Troubleshoot installation and login - Claude Code Docs\n4. [BUG] install.sh serves Linux ARM64 (ELF) binary on macOS ARM64, causing "exec format error" · Issue #29661 · anthropics/claude-code\n5. Quickstart\n\nSynthesis:\nThe invalid signature error when running Claude Code on newer macOS versions (specifically macOS 26+) occurs because the operating system's stricter Apple System Policy (ASP) rejects the binary's older "obsolete resource envelope" signature format [1].\n\nTo resolve this, you can manually re-sign the local binary with a modern ad-hoc signature [1]. Run the following command in your terminal, replacing the path with the location of your specific version [1]:\n\ncodesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/<your-version-number>/claude [1]\n\nYou must re-run this command whenever Claude Code auto-updates to a new version [1].\n\nHighlights:\n<result id="1">\n[BUG] Claude CLI killed by kernel on macOS 26 beta - obsolete code signature format · Issue #20407 · anthropics/claude-code\nhttps://github.com/anthropics/claude-code/issues/20407\n## [BUG] Claude CLI killed by kernel on macOS 26 beta - obsolete code signature format\n...\nClaude CLI binary is immediately killed by the kernel when launched on macOS 26 beta.\n...\nThe shell shows zsh: killed with no other output. The kernel log shows:\n - proc: load code signature error 2 for file \"2.1.17\"\n - (AppleSystemPolicy) ASP: Security policy would not allow process\n...\nRoot cause: The binary's code signature has an "obsolete resource envelope" format (error -67002) that macOS 26's stricter Apple System Policy enforcement rejects, even though the signature is valid and properly notarized.\n...\nclaude --version\n...\nzsh: killed claude\n...\nlog show):\n...\nkernel: proc\n...\n7883: load code signature error 2 for file "2.1.17"\n...\nkernel: (AppleSystemPolicy) ASP: Security policy would not allow process:\n...\n7883, /Users\n...\n"obsolete resource\n...\n-670\n...\n1. Install macOS 26 beta (Tahoe) - build 25C56 or similar\n 2. Install Claude CLI via curl -fsSL https://claude.ai/install.sh | sh\n 3. Run claude --version\n 4. Observe: zsh: killed\n...\nWorkaround that confirms the issue:\n 5. Re-sign the binary: codesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/2.1.17\n 6. Run claude --version again\n 7. Now it works: 2.1.17 (Claude Code)\n...\nThe binary's code signature is valid and properly signed by Anthropic:\n - Authority: Developer ID Application: Anthropic PBC (Q6L2SF6YDW)\n - CodeDirectory v=20500 with runtime flag\n - codesign --verify passes\n...\nHowever, macOS 26 beta has stricter Apple System Policy (ASP) kernel enforcement that rejects the "obsolete resource envelope" signature format.\n...\nSuggested fix: Re-sign the Claude CLI binary with updated signature tooling that produces a modern resource envelope format compatible with macOS 26's stricter requirements.\n...\nTemporary user workaround:\n codesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/2.1.17\n\n\n<result id="2">\nAdvanced setup\nhttps://code.claude.com/docs/en/setup.md\nTo install Claude Code, use one of the following methods:\n...\n## Native Install (Recommended)\n...\nmacOS, Linux, WSL:\n...\nbash\ncurl -fsSL https://claude.ai/install.sh | bash\n\n\n...\n### Install a specific version\n...\nThe native installer accepts either a specific version number or a release channel (latest or stable). The channel you choose at install time becomes your default for auto-updates. See configure release channel for more information.\n...\nTo install the latest version (default):\n...\n## macOS, Linux, WSL\n...\nbash\ncurl -fsSL https://claude.ai/install.sh | bash\n\n\n...\nTo install the stable version:\n...\n## macOS, Linux, WSL\n...\nbash\ncurl -fsSL https://claude.ai/install.sh | bash -s stable\n...\nTo install a specific version number:\n...\n## macOS, Linux, WSL\n...\nbash\ncurl -fsSL https://claude.ai/install.sh | bash -s 2.1.89\n...\n### Binary integrity and code signing\n...\nEach release publishes a manifest.json containing SHA256 checksums for every platform binary. The manifest is signed with an Anthropic GPG key, so verifying the signature on the manifest transitively verifies every binary it lists.\n...
The user is on macOS Sequoia.
>sw_vers; uname -m{
"output": "ProductName:\t\tmacOS\nProductVersion:\t\t15.7.2\nBuildVersion:\t\t24G325\narm64\n",
"rejected": false,
"notInterrupted": true
}>codesign --force --sign - --preserve-metadata=entitlements /Users/gaganarora/.local/share/claude/versions/2.1.183 2>&1; echo "---"; /Users/gaganarora/.local/share/claude/versions/2.1.183 --version 2>&1; echo "exit: $?"{
"output": "/Users/gaganarora/.local/share/claude/versions/2.1.183: replacing existing signature\n---\n2.1.183 (Claude Code)\nexit: 0\n",
"rejected": false,
"notInterrupted": true
}Ad-hoc re-signing fixed the terminal issue.
Re-signing fixed it. Verifying the claude command and setting up a post-update safeguard.
>claude --version 2>&1; echo "exit: $?"; claude doctor 2>&1 | head -30{
"output": "\u001b]633;C\u00072.1.183 (Claude Code)\nexit: 0\n",
"rejected": false,
"notInterrupted": true,
"backgroundShellId": 581162
}{
"success": true,
"finalTodos": [
{
"content": "Diagnose claude CLI failure in terminal",
"status": "completed",
"id": "1"
},
{
"content": "Apply fix based on root cause",
"status": "completed",
"id": "2"
},
{
"content": "Verify claude works after fix",
"status": "in_progress",
"id": "3"
}
],
"initialTodos": [
{
"content": "Diagnose claude CLI failure in terminal",
"status": "in_progress",
"id": "1"
},
{
"content": "Apply fix based on root cause",
"status": "pending",
"id": "2"
},
{
"content": "Verify claude works after fix",
"status": "pending",
"id": "3"
}
],
"wasMerge": true
}The Claude doctor process appears to be hanging or stuck.
>kill 12047 2>/dev/null; claude --version{
"output": "2.1.183 (Claude Code)\n",
"rejected": false,
"notInterrupted": true
}{
"success": true,
"finalTodos": [
{
"content": "Diagnose claude CLI failure in terminal",
"status": "completed",
"id": "1"
},
{
"content": "Apply fix based on root cause",
"status": "completed",
"id": "2"
},
{
"content": "Verify claude works after fix",
"status": "completed",
"id": "3"
}
],
"initialTodos": [
{
"content": "Diagnose claude CLI failure in terminal",
"status": "completed",
"id": "1"
},
{
"content": "Apply fix based on root cause",
"status": "completed",
"id": "2"
},
{
"content": "Verify claude works after fix",
"status": "in_progress",
"id": "3"
}
],
"wasMerge": true
}Fixed. claude should work in your terminal now.
The Claude Code binary at ~/.local/share/claude/versions/2.1.183 had an invalid code signature. macOS was killing it immediately (exit code 137 / zsh: killed) before it could print anything.
That often happens after an auto-update, or when macOS security rejects the signature format on the installed build.
Re-signed the binary with a local ad-hoc signature:
codesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/2.1.183Verified:
claude --version# 2.1.183 (Claude Code)Claude Code auto-updates can replace the binary and bring the problem back. Run this (swap in the new version number if needed):
codesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/$(claude --version 2>/dev/null | cut -d' ' -f1 || ls ~/.local/share/claude/versions/ | grep -E '^[0-9]' | sort -V | tail -1)Or reinstall cleanly:
curl -fsSL https://claude.ai/install.sh | bashThen re-run the codesign command above if macOS still kills it.
Try claude in your terminal — it should start normally now.
<system_notification> The following task has finished. If you were already aware, ignore this notification and do not restate prior responses.
kind: shell status: aborted task_id: 581162 title: Verify claude CLI works end-to-end output_path: /Users/gaganarora/.cursor/projects/Users-gaganarora-Desktop-my-projects-agent-skills/terminals/581162.txt Briefly inform the user about the task result and perform any follow-up actions (if needed). If there's no follow-ups needed, don't explicitly say that.Preparing a brief update on the task result.
💸 Sponsored by AI Miles — Ramp · save time & money
Done. Your claude CLI was being killed by macOS because the installed binary had an invalid code signature. I re-signed it locally, and claude --version now returns 2.1.183 (Claude Code) successfully.
You can run claude in your terminal again. If it breaks after a future auto-update, re-run:
codesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/2.1.183(Replace 2.1.183 with whatever version is in ~/.local/share/claude/versions/ if it updates.)
https://madebythomas.ai/ this is what my project was supposed to be find out the gaps its deployed on ipop.ai and make github issyes https://github.com/gagan114662/agent-skills very disappointed i am working on this for days with claude
codesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/2.1.183claude --version# 2.1.183 (Claude Code)codesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/$(claude --version 2>/dev/null | cut -d' ' -f1 || ls ~/.local/share/claude/versions/ | grep -E '^[0-9]' | sort -V | tail -1)curl -fsSL https://claude.ai/install.sh | bashcodesign --force --sign - --preserve-metadata=entitlements ~/.local/share/claude/versions/2.1.183