Loading...
Loading...
Use when Claude Code auth fails over SSH on macOS, keychain is locked in headless/remote sessions, or setting up Claude Code on a Mac for remote access
npx skill4agent add soulmachine/skills ssh-keychain-unlockClaude Code-credentialssecurity show-keychain-info ~/Library/Keychains/login.keychain-db~/.zshrc# Unlock macOS keychain for SSH sessions (needed for Claude Code auth)
if [[ -n "$SSH_CONNECTION" ]]; then
security unlock-keychain ~/Library/Keychains/login.keychain-db 2>/dev/null
fi~/.claude/.keychain-password600echo 'YOUR_MACOS_PASSWORD' > ~/.claude/.keychain-password
chmod 600 ~/.claude/.keychain-password~/.claude/unlock-keychain.sh700cat > ~/.claude/unlock-keychain.sh << 'SCRIPT'
#!/bin/bash
security unlock-keychain -p "$(cat ~/.claude/.keychain-password)" ~/Library/Keychains/login.keychain-db
SCRIPT
chmod 700 ~/.claude/unlock-keychain.sh~/Library/LaunchAgents/com.claude.unlock-keychain.plistcat > ~/Library/LaunchAgents/com.claude.unlock-keychain.plist << 'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.claude.unlock-keychain</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>__HOME__/.claude/unlock-keychain.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
PLIST
# Fix path
sed -i '' "s|__HOME__|$HOME|g" ~/Library/LaunchAgents/com.claude.unlock-keychain.plistlaunchctl load ~/Library/LaunchAgents/com.claude.unlock-keychain.plist| Command | Purpose |
|---|---|
| Check keychain lock status |
| Manually unlock (interactive) |
| Test auto-unlock script |
| Load LaunchAgent |
| Unload LaunchAgent |
600launchctl load~/.claude/.keychain-password