[BUG] [SOLVE!] Missing API key when SSH'ing into macOS
Resolved 💬 24 comments Opened Aug 10, 2025 by kennedybaird Closed Jan 9, 2026
This is my current fix for the bug mentioned across multiple issues: #5244 #5369 #5242 #5235 #5167 #5166 #5118
- Run
security unlock-keychain ~/Library/Keychains/login.keychain-db - Run
claude, complete login flow - You will still see
Missing API keyerror - Type
exit - Run
claudeagain and message will be gone.
The above works for me on latest native install:
Diagnostics
└ Currently running: native (1.0.72)
└ Path: /Users/kennedybaird/.local/bin/claude
└ Invoked: /$bunfs/root/claude
└ Config install method: native
└ Auto-updates enabled: true
24 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
well done
Works for me! Thank you @kennedybaird
Hopefully Anthropic fixes this bug, soon, or at least communicates an update or maybe even an acknowledgement of the issue.
Great job! it works!
Is this solution permanent, or should it be rerun after reboot? If so, is there any way to make it permanent? like putting in a startup script or something
Thanks, worked a treat. Used this in conjunction with
claude setup-token.EDIT: as @sahsu points out below, this may trigger API usage.
this will generate API mode hope you check already.
I needed to run it twice
security unlock-keychain ~/Library/Keychains/login.keychain-db
then it worked (so whole process twice)
Thank you. I wasted 2 hours trying to debug it. Your solution worked.
Thank you very much, the issue has been resolved after following your advice.
This did not work for me. I tried running it twice, too. The command also doesn't seem to produce any errors even I enter a random password for the keychain.
Furthering the ssh theory, this seems to be an issue of the copied/pasted token
Pure SSH
If I
The missing API bug persists. _but_
SSH/Screen Sharing combo
If I
everything works
Thank you, your method successfully solved my problem. However, I'm very disappointed with Claude Code; I found many issues related to it, but they haven't been resolved. This is irresponsible!
Hey guys, this is an important regression. Can someone please at least acknowledge it? This makes life much more annoying for me if I need to run this command each time I run claude.
Does not work... Claude clearly has bug when it comes to remote-ssh. Probably just a security choice, because it totally prevent people from hacking into your terminal with remote-ssh and use the AI resources
Confirmed I'm still getting this issue when attempting to use claude in an ssh'd session
This works on the local terminal but still doesn't work on remote ssh or tmux/screen sessions.
Any help idea? THX!
This worked for me over SSH, though I had to run
unlock-keychaintwice before it worked.I have this issue as well and none of the solutions here worked.
running
security unlock-keychainworked for me (and also logging in locally through vnc, but I used/logoutfirst)
Is there some trick so that I don't have to do the unlock-keychain thing everytime i want to use claude over phone?
For now I added this to my fish terminal:
so that I'm prompted for password first thing I open ssh terminal. Minor improvement.
It really worked. If you're running within a IDE (like VSCode) you have to unlock from the opened terminal within the IDE. Is obvious but some people can miss that (like I did in the first try).
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.