Claude Code Not Logged In Please Run Login
When Claude Code shows Not logged in · Please run /login right after Login successful, unlock the macOS keychain or use claude auth login and setup-token in your local shell.
Quick answer
Match Not logged in · Please run /login immediately after Login successful, often with claude doctor reporting Auth token: none or macOS Keychain is not writable. On macOS, unlock the login keychain, then relaunch Claude Code. Prefer the shell command claude auth login over in-session /login when the keychain ACL drops the token. If login still does not stick, run claude setup-token and set CLAUDE_CODE_OAUTH_TOKEN only in your local shell or profile — never paste the token into a chat. This is not the API Error: 401 login screen and not a weekly-limit wait.
On this page
What we're seeing
- The exact screen pairing is Login successful followed immediately by Not logged in · Please run /login.
- Independent May–September 2026 first-hand anthropics/claude-code issues quote that pairing, often with claude doctor showing Auth token: none or macOS Keychain is not writable.
- First-hand leftovers include unlocking the login keychain, preferring shell claude auth login over in-TUI /login, and using setup-token with a local environment variable when persistence fails.
- A different screen that includes API Error: 401 with Please run /login is a separate fingerprint.
- Weekly-limit and overloaded waits are out of scope.
Start here
Try these first
Fix 1
Confirm Not logged in after Login successful
Match the post-success login loop before changing keychain or token env settings.
- Read the transcript. This guide is for Not logged in · Please run /login right after Login successful.
- If the line includes API Error: 401 or Invalid authentication credentials as the primary failure, stop here and treat it as a different fingerprint.
- Run claude doctor and note whether it reports Auth token: none or that the macOS Keychain is not writable.
Applies to Windows, Mac, Desktop
Fix 2
Unlock the macOS login keychain
First-hand macOS reports clear the immediate Not logged in loop after unlocking the login keychain so Claude Code can store the OAuth token.
- In Terminal, unlock the login keychain with security unlock-keychain ~/Library/Keychains/login.keychain-db and enter your Mac login password when prompted.
- Fully quit Claude Code and start a new session.
- Sign in again, then run claude doctor and confirm an auth token is present.
Applies to Mac, Desktop
Fix 3
Prefer shell claude auth login
First-hand reports show in-session /login can succeed in the UI while the keychain ACL still drops the token. The shell auth login path is the stronger leftover for that pattern.
- Quit the stuck Claude Code session.
- In Terminal, run claude auth login and complete the browser flow.
- Start Claude Code again and confirm you stay signed in without an immediate Not logged in · Please run /login loop.
Applies to Windows, Mac, Desktop
Fix 4
Use setup-token in your local shell only
When keychain persistence still fails, first-hand reports use claude setup-token and set CLAUDE_CODE_OAUTH_TOKEN in the local shell or profile. Store the value only on your machine. Never paste the token into a chat, ticket, or screenshot.
- In Terminal, run claude setup-token and follow the prompts on your machine.
- Set CLAUDE_CODE_OAUTH_TOKEN in your local shell profile or session environment only.
- Open a new terminal, start Claude Code, and confirm the Not logged in loop is gone.
- Do not paste the token into Claude chat, GitHub, or any remote form.
Applies to Windows, Mac, Desktop
Device notes
- Windows
- Prefer shell claude auth login and local setup-token env leftovers when Credential Manager or file-login loops drop the session. Never paste tokens into chat.
- Mac
- Keychain not writable and Auth token: none in claude doctor are the common companions. Unlock the login keychain before setup-token.
- Desktop
- This fingerprint is the immediate post-success login loop, not the separate API Error: 401 screen.
Official information
Checked on 9 September 2026, anthropics/claude-code GitHub issues that quote Login successful followed by Not logged in · Please run /login document first-hand leftovers for unlocking the macOS login keychain, preferring shell claude auth login, and using setup-token with a local CLAUDE_CODE_OAUTH_TOKEN. Official Claude Code auth docs describe login and setup-token flows but do not publish a dedicated page that names only this immediate post-success loop.
Sources
Keep troubleshooting
Related problems
Claude
Claude Code MCP Error -32000 Connection Closed
Windows · Mac · DesktopUpdated Sep 7, 2026
Claude
Claude Code PreToolUse Bash Hook Error
Windows · Mac · DesktopUpdated Sep 7, 2026
Claude
Claude Code API Error 401 Please Run Login
Windows · Mac · DesktopUpdated Sep 10, 2026
Claude
Claude Code Credit Balance Too Low
Windows · Mac · DesktopUpdated Sep 12, 2026