[BUG] macOS 26: /login completes ("Login successful") but token never written to Keychain — browser does not auto-open, device code flow used instead
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
On macOS 26.4 (Apple Silicon), /login completes the OAuth flow and shows
"Login successful", but the authentication token is never persisted to the
macOS Keychain. As a result, even in the same session immediately after
"Login successful", any message returns "Not logged in · Please run /login".
Two additional symptoms are present:
- The browser does not auto-open during /login (even though
open <url>
works fine from the same shell). Claude Code falls back to displaying the
URL manually and using the device code flow (manual code paste).
- claude doctor consistently reports "macOS Keychain is not writable",
even after deleting the existing Keychain entry and even after
pre-creating a "Claude Code-credentials" entry with the -A flag
(allow all applications).
What Should Happen?
After completing /login (either via browser redirect or device code flow),
the authentication token should be persisted to the macOS Keychain so that
subsequent sessions do not require re-authentication.
The browser should also auto-open during /login when a default browser is
configured and open <url> works from the shell.
Error Messages/Logs
claude doctor output:
Installation warnings ⚠
├ macOS Keychain is not writable. Console login will fail to save
your API key.
└ Run: security unlock-keychain ~/Library/Keychains/login.keychain-db
/status output (immediately after "Login successful"):
Auth token: none
After /login:
security find-generic-password -a "$(whoami)" -s "Claude Code-credentials" -w
→ security: SecKeychainSearchCopyNext: The specified item could not be
found in the keychain.
Steps to Reproduce
- Install Claude Code via native installer on macOS 26.4 (Apple Silicon):
curl -fsSL https://claude.ai/install.sh | bash
- Run: claude
- Run /login inside Claude Code
- Note: browser does NOT auto-open. URL is displayed in terminal.
Claude Code falls back to device code flow.
- Manually open URL in browser (Arc or Safari — tested both).
Browser shows "認証コード / Authentication Code" page with a manual code.
- Paste the code into Claude Code when prompted → "Login successful" appears
- Immediately run /status → Auth token: none
- Type any message → "Not logged in · Please run /login"
- Confirm Keychain was not written:
security find-generic-password -a "$(whoami)" -s "Claude Code-credentials" -w
→ item could not be found
Additional diagnostic steps performed:
- security unlock-keychain ~/Library/Keychains/login.keychain-db → no effect
- Deleted existing Keychain entry, re-ran /login → same result
- Pre-created entry with -A flag (allow all apps):
security add-generic-password -a "$(whoami)" \
-s "Claude Code-credentials" -w '{"placeholder":"placeholder"}' -A
→ after /login, entry still shows placeholder (not updated by Claude Code)
- security add-generic-password with a test service name → SUCCESS
(Keychain is writable from CLI)
- xattr -l $(which claude) → no quarantine attribute
- open "https://claude.ai" → browser opens correctly
- sw_vers → ProductVersion: 26.4
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown — last known working around 2026-05-09 based on a Keychain entry timestamp. Exact version not recorded.
Claude Code Version
2.1.185
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Workaround currently in use:
claude setup-token → export CLAUDE_CODE_OAUTH_TOKEN=<token>
This works but provides user:inference scope only (user:profile missing).
Reproduced in both Terminal.app (macOS) and VS Code integrated terminal.
Related issue: #48162 (similar "macOS Keychain is not writable" symptom
caused by missing -U flag on add-generic-password). However, this issue
differs in that the token is not written even when no Keychain entry exists,
and even when a pre-created entry with -A (allow all apps) is present:
# Pre-created entry to rule out ACL as the cause:
security delete-generic-password -a "$(whoami)" -s "Claude Code-credentials"
security add-generic-password -a "$(whoami)" -s "Claude Code-credentials" \
-w '{"placeholder":"placeholder"}' -A
# After /login → "Login successful", entry still shows placeholder.
# Claude Code did not update it.
Keychain writability confirmed from CLI (different service name works):
security add-generic-password -a "$(whoami)" -s "test-write" -w "testvalue"
→ SUCCESS
Browser auto-open:
open "https://claude.ai" works from shell, but claude binary does not
trigger browser open during /login. Falls back to device code flow
(manual code paste in terminal). This behavior is consistent across
Terminal.app and VS Code integrated terminal.
After pasting the device code and seeing "Login successful":
- /status shows: Auth token: none
- Sending any message returns: Not logged in · Please run /login
- security find-generic-password → item could not be found
codesign output on binary:
codesign -v ~/.local/share/claude/versions/2.1.185 --deep
→ "the code is valid but does not seem to be an app"
No quarantine attribute on binary:
xattr -l $(which claude) → (no output)
Hypothesis: macOS 26 may be restricting Keychain write access and/or
URL-open capabilities for native binaries in ~/.local/share/ that are
not packaged as .app bundles. Both failures (browser not opening,
Keychain not writable) may share the same root cause related to macOS 26
security policy changes for non-app-bundle binaries.
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This issue is NOT a duplicate of #44585 (Windows-specific).
#63919 and #65466 share similar symptoms, but this issue includes
macOS 26-specific diagnostics that may help identify the root cause:
These additional symptoms suggest macOS 26 may be applying new security
restrictions to native binaries in ~/.local/share/ that are not .app bundles.
Run into the same problem (running the same version of claude code). Found a bypass but no way to actually fix the core issue.
Also, started to happen for me after my mac auto updated to version Tahoe 26.5.1 (25F80)
Run these in your terminal:
claude setup-token
Copy the printed token, then:
read -rs "?Paste token then Enter: " TOK && print -r -- "export CLAUDE_CODE_OAUTH_TOKEN=\"$TOK\"" >> ~/.zshrc && unset TOK
exec zsh
claude --version && echo "token set: ${CLAUDE_CODE_OAUTH_TOKEN:+yes}"
I have the same problem. Unfortunately the workaround seem not to work for me, I stell get
Tried several times, also adding the Token manually to env.
I just got a Mac, running latest as of today. Same issues. Adding in hopes of keeping this one open as it is the most identical to what I see compared to the other proposed duplicates.
This is not the same issue as 63919. but it seems the 63919 is closed. I'm on Tahoe 26.6.2
This is not the same issue as 63919. but it seems the 63919 is closed. I'm on Tahoe 26.6.2
The [keychain] readAsync failed; not caching a null line
It persists after a full reboot
The Keychain entry itself exists and looks normal (ruling out a missing-credential explanation)
Claude Code version (2.1.236) and install method (Homebrew cask)