Update: After extensive investigation I have identified what appears to be the root
cause of the 401 Invalid Bearer Token error on my Intel Mac, and I want to share
the findings in case they help others reporting similar issues on M1 and M4 machines.
WHAT I FOUND (Intel Mac - x86_64):
The Claude Agent binary that Xcode downloads is the darwin-arm64 build regardless
of host architecture. On my Intel Mac this binary physically cannot execute, which
fails silently and surfaces as a 401 error.
Confirmed via terminal:
file ~/Library/Developer/Xcode/CodingAssistant/Agents/claude/2.1.14/claude
Returns: Mach-O 64-bit executable arm64 — wrong for Intel Mac
The IDEChatClaudeCodeVersion preference is hardcoded to the ARM64 download URL:
defaults read com.apple.dt.Xcode IDEChatClaudeCodeVersion
Returns: darwin-arm64 URL regardless of CPU architecture
We also confirmed the darwin-x64 binary exists in Anthropic's distribution bucket
and runs correctly on Intel — both in the terminal and as a standalone binary:
curl -fsSL -o /tmp/claude-x64 "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/2.1.14/darwin-x64/claude"
/tmp/claude-x64 --version
Returns: 2.1.14 (Claude Code) — works fine on Intel
Claude Code also works perfectly in Terminal on this Intel Mac. The problem is
exclusively with the Claude Agent inside Xcode, which downloads and attempts to
run the wrong ARM64 binary.
However, manually placing the x64 binary in the agent directory fails with:
"Failed to initialize Claude Agent: The code signing identity for the agent did
not match expectations, or the agent violated sandboxing rules."
This means Xcode's code signing verification also rejects the x64 binary, so
there is currently no workaround for Intel Mac users wanting to use the Claude
Agent inside Xcode.
Note: Claude chat in Xcode works perfectly on this Intel Mac — only the Agent
and coding intelligence features are broken. This confirms the issue is the
binary architecture, not account credentials, plan level, or network
connectivity. Clearing all keychain entries, Xcode preferences, and cached
credentials had no effect on the 401 error.
A bug report has been filed with Anthropic here:
https://github.com/anthropics/claude-code/issues/40642
IMPORTANT QUESTION FOR M1/M4 USERS:
Since others on this thread are reporting the same 401 error on Apple Silicon
machines where the ARM64 binary should work correctly, the architecture mismatch
may not be the only cause of this error.
Could affected M1/M4 users please run the following in Terminal and post the results:
Check the binary architecture:
file ~/Library/Developer/Xcode/CodingAssistant/Agents/claude/2.1.14/claude
Check whether Claude chat works but agent features do not:
Try the coding assistant chat vs inline code fixes and agentic coding features
and report which work and which fail.
Check your Claude plan:
Pro, Max, Team, or Free
This will help determine whether there are multiple separate bugs causing the same
401 error on different hardware, or one common root cause affecting everyone.
If you are affected please also add a comment to the GitHub issue above with your
Mac model and architecture so Anthropic can see the full scope of the problem.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: