Run two Claude Code accounts simultaneously on macOS without re-authenticating by using separate configuration directories.
-
Create Separate Config Directories
mkdir ~/.claude-account1 mkdir ~/.claude-account2
-
Add Aliases to Shell Config
- Open
~/.zshrc(or~/.bashrcfor Bash) in an editor:nano ~/.zshrc - Add:
alias claude-account1="CLAUDE_CONFIG_DIR=~/.claude-account1 claude" alias claude-account2="CLAUDE_CONFIG_DIR=~/.claude-account2 claude"
- Save and reload:
source ~/.zshrc
- Open
-
Authenticate Each Account
- For account 1:
Log in; credentials save to
claude-account1
~/.claude-account1. - For account 2:
Log in; credentials save to
claude-account2
~/.claude-account2.
- For account 1:
-
Switch or Run Simultaneously
- Run
claude-account1orclaude-account2in separate terminal tabs (Cmd + T). - Each uses its own config and usage limits.
- Run
- Requires separate Anthropic accounts (different emails).
- Check Anthropic’s terms to ensure compliance.
- Update Claude Code:
npm install -g @anthropic-ai/claude-code. - If re-authentication occurs, verify
CLAUDE_CONFIG_DIRwithecho $CLAUDE_CONFIG_DIR.
While using multiple accounts I kept losing context when a session hit the 5-hour limit mid-flow. Built a hook that monitors
usage per account and silently warns Claude at 95% so it can save memory/notes before the session cuts off. Maybe it's useful to someone.
5. Monitor Usage Limits per Account
When running multiple accounts, you want to know when a specific account is approaching its 5-hour usage limit. This hook
automatically warns Claude at 95% usage — per account — using
CLAUDE_CONFIG_DIRto target the right credentials.Create the hook script (repeat for
~/.claude-account2/hooks/):Paste:
chmod +x ~/.claude-account1/hooks/session-age-warn.shRegister the hook in
~/.claude-account1/settings.json:{ "hooks": { "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "/Users/YOUR_USERNAME/.claude-account1/hooks/session-age-warn.sh" } ] } ] } }Repeat for
~/.claude-account2/, pointing the command path to that directory.How it works:
CLAUDE_CONFIG_DIR(sha256 prefix). The hook usesthe same derivation to look up the right account's token.
https://api.anthropic.com/api/oauth/usageand checksfive_hour.utilization.the session ends.