How do you run two Claude accounts on one machine?
Short answer
Give each Claude account its own config folder, which Anthropic documents. Your default account stays in ~/.claude. Start Claude Code with CLAUDE_CONFIG_DIR=~/.claude-work, run /login once to sign in the other subscription, and add a shell alias. Each agent then runs on the account whose folder it was started with, and each account keeps its own limits.
On this page
How it works
Claude Code keeps settings, session history and plugins in one configuration folder, ~/.claude by default. The CLAUDE_CONFIG_DIR environment variable points it at a different folder. Each folder has its own settings, history and claude.ai login, so two folders keep two accounts signed in at once.12
Anthropic says
“To stay signed in to multiple accounts at once, such as work and personal accounts, give each account its own configuration directory.”
Authentication, Log in with multiple accounts, code.claude.com · Checked .
The environment variables reference says the same, and calls the variable "Useful for running multiple accounts side by side," with the alias alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude' as its example.2
Set up the second account
-
Pick a folder name
Any path works. A name that says which account it holds is easier to live with, such as
~/.claude-work. -
Start Claude Code with that folder and sign in
CLAUDE_CONFIG_DIR=~/.claude-work claude # inside Claude Code, then finish in the browser /loginThe first run in a new folder walks you through login and setup. You do this once per folder.1
-
Add an alias
Put this in
~/.zshrcor~/.bashrcand open a new terminal.claudestays on your default account andclaude-workuses the other one.alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude' -
Check which account each folder holds
claude auth status --text CLAUDE_CONFIG_DIR=~/.claude-work claude auth status --textclaude auth statusprints JSON by default, and--textmakes it readable. Since v2.1.268 the JSON includes aconfigDirectoryfield naming the folder in use.3 Inside a session,/statusshows which plan and organization the sign-in uses.1
One tmux session per account
For agents that run for hours, put each in its own tmux session and start it with the folder of the account it should use. tmux's -e flag sets a variable for everything in that session, so plain claude inside it uses that account.5
Prefixing the account to the session name, as in work-api, makes tmux ls show which account each agent is on.
| Config folder | Account | Start an agent on it with |
|---|---|---|
~/.claude | Personal, the default | claude |
~/.claude-work | Work | claude-work, or CLAUDE_CONFIG_DIR=~/.claude-work claude |
Details that trip people up
- Where the sign-in lives. On Linux the login is stored in
.credentials.jsoninside the folder. On macOS it goes in the Keychain, and the Keychain entry is keyed to the folder, so each folder reads its own.1 - Console logins without an API key are the exception. Anthropic notes that separate folders do not keep two such Claude Console sign-ins apart, because they are stored outside the configuration folder.1
- Set it in your shell, not the project. Project and local settings files cannot set
CLAUDE_CONFIG_DIR. In a user settings file, write the absolute path, because~is not expanded there.2 - A running agent stays on its account. To move one, exit it and start it again under the other folder with
claude --continueto pick up the latest conversation in that project folder.3
See usage for each account
Each subscription has its own 5-hour and weekly limits. Inside Claude Code, /usage shows the plan usage bars for the account that session is signed in to.7 Two open-source tools read the local logs of several folders:
ccusage accepts a comma-separated list in CLAUDE_CONFIG_DIR, but it combines the data from every folder in the list, so run it once per folder to see each account.4 Claude Code Usage Monitor's --data-paths scans several folders "without merging unrelated accounts into one 5-hour window."6 Both estimate from local logs on this machine. They do not read Anthropic's own percentage for the account.
Common questions
Does the second account change my default one?
No. Your default account stays in ~/.claude and is not touched. The second account lives in its own folder.
Do I have to sign in every time?
No. You sign in once per folder. After that, starting Claude Code with that folder uses the account already signed in there.
Is CLAUDE_CONFIG_DIR an official feature?
Yes. Anthropic documents it in the Claude Code environment variables reference and in the authentication guide, which shows the claude-work alias as its example for running multiple accounts side by side.
How do I tell which account a session is using?
Run /status inside the session, or claude auth status --text in the shell with the same CLAUDE_CONFIG_DIR. Naming tmux sessions after the account also helps.
Can two people share one Claude account this way?
No. Anthropic's Consumer Terms say you may not share your account credentials or make your account available to anyone else. Config folders are for accounts that are each yours.
Sources
- Authentication: Log in with multiple accounts, Credential managementClaude Code docs, AnthropicUndated · Checked
- Environment variables: CLAUDE_CONFIG_DIRClaude Code docs, AnthropicUndated · Checked
- CLI reference: claude auth status, --continueClaude Code docs, AnthropicUndated · Checked
- ccusage: Claude Code data source and directory detectionccusageUndated · Checked
- tmux(1) manual page, new-session -etmux projectUndated · Checked
- Claude Code Usage Monitor READMEMaciek-roboblog on GitHubUndated · Checked
- Commands: /usageClaude Code docs, AnthropicUndated · Checked