CLAUDE_CONFIG_DIR: two Claude Code profiles on one machine
Point Claude Code at a config folder per profile and keep two accounts signed in at once. One alias each, and what each folder keeps to itself.
Contents
To run two Claude Code profiles on one machine, give each one its own config folder and point CLAUDE_CONFIG_DIR at it with a shell alias: alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'. Each folder keeps its own sign-in, settings and history, so both accounts stay signed in at once. The catch: almost nothing else is shared either.
This guide covers the setup, what each profile keeps to itself, how to share the parts you want shared, and where the manual way stops.
What CLAUDE_CONFIG_DIR changes#
Claude Code keeps its configuration in ~/.claude by default. Anthropic's environment variable reference describes CLAUDE_CONFIG_DIR as the override for that folder: "All settings, session history, and plugins are stored under this path", and it names the use case directly: "Useful for running multiple accounts side by side" (Claude Code docs: Environment variables).
The sign-in follows the folder too. The authentication page says each directory "has its own settings, session history, and claude.ai login or API key". On Linux and Windows the login sits in .credentials.json inside the folder. On a Mac it's in the Keychain, and Claude Code "keys the macOS Keychain entry to that directory too, so a session with a different CLAUDE_CONFIG_DIR reads a different entry" (Claude Code docs: Authentication).
One exception from the same page: two Claude Console sign-ins made without an API key aren't kept apart, because Claude Code stores that kind of sign-in outside the config folder. Claude Pro, Max, Team and Enterprise logins are kept apart.
How to set up two profiles#
- Pick a folder per profile, for example
~/.claude-workand~/.claude-personal. Claude Code creates them on first run. - Add one alias per profile to
~/.zshrcor~/.bashrc:
alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'
alias claude-personal='CLAUDE_CONFIG_DIR=~/.claude-personal claude'
- Open a new terminal and run
claude-work. Claude Code walks you through login and setup for that folder. Sign in with your work account. - Run
claude-personaland sign in with the other account. - Check which account each one uses with
/statusinside the session.
You can keep plain claude for a third profile in ~/.claude, or leave it as your default. Two terminals can run both aliases at the same time.
The aliases reach only a terminal. The VS Code extension shares the terminal's default login, and a project's .vscode/settings.json can't set CLAUDE_CONFIG_DIR for it, so an account per project in VS Code takes a VS Code profile per account. On Windows the alias becomes a PowerShell function or a .cmd file, both written out in two Claude Code accounts on Windows.
If you'd rather set the variable in a settings file, Anthropic's reference says to write the absolute path ("CLAUDE_CONFIG_DIR": "/home/you/.claude-work") and that project and local settings can't set it. Your shell, your user settings or managed settings can.
What each profile keeps to itself#
A profile is more than a sign-in. Everything Claude Code keeps in its config folder is now per profile.
| Kept per profile | What that means day to day |
|---|---|
| Sign-in | Each profile uses its own account's 5-hour and weekly limits |
Session history (projects/) |
/resume in one profile doesn't list the other profile's chats |
Prompt history (history.jsonl) |
Up-arrow and Ctrl+R only recall what you typed in that profile |
settings.json, CLAUDE.md, skills, agents, commands |
Your personal setup has to exist in both folders |
| Plugins | Installed per profile |
| User-scope MCP servers | Added and signed in to once per profile |
The .claude directory page lists what lives in the folder, from transcripts to prompt history, and says that with CLAUDE_CONFIG_DIR set, "every ~/.claude path on this page lives under that directory instead" (Claude Code docs: Explore the .claude directory).
MCP servers deserve their own note. Anthropic's MCP page says user-scope servers "are stored in ~/.claude.json" (Claude Code docs: MCP). In practice, a Claude Code started with CLAUDE_CONFIG_DIR writes its .claude.json inside that folder; every account folder Shuriken creates has its own. So a server you add with claude mcp add --scope user in one profile doesn't appear in the other, and its sign-in (Linear, Notion, GitHub) happens twice.
What is shared: anything in the repository. A project's CLAUDE.md, its .mcp.json and its .claude/settings.json are files in your repo, so every profile reads them.
How to share the parts you want shared#
The usual trick is symbolic links: keep one real copy in ~/.claude and link it into each profile folder.
ln -s ~/.claude/CLAUDE.md ~/.claude-work/CLAUDE.md
ln -s ~/.claude/skills ~/.claude-work/skills
ln -s ~/.claude/agents ~/.claude-work/agents
A few rules we'd follow:
- Never link the sign-in.
.credentials.jsonand the Keychain entry must stay per folder, or the profiles stop being separate. - Link before the first run, or move the folder's own copy out of the way first, so you don't lose what Claude Code already wrote there.
- Be careful with
projects/. Linking it shares session history, which is what lets you resume one account's chat under the other. Our guide on keeping the same chat across Claude accounts covers what carries over and what breaks. - Settings and MCP lists still drift. A setting you change in one profile only lands in the other if that file is linked.
Where the manual way stops#
Two aliases are a good setup if you switch now and then, on one computer. Past that:
- Switching is still you. Nothing watches usage. When one account runs out, you notice, quit, and start the other alias.
- The turn that hit the limit stays failed. You resume and ask again on the other profile.
- It's per machine. Every computer needs the same folders, aliases and links.
The other free and cheap options, including switcher CLIs, are in how to switch Claude accounts without logging out.
A word on the rules#
Anthropic's consumer terms say you may not share your account login or credentials, or make your account available to anyone else (Anthropic Consumer Terms). Separate profiles are for accounts you own and are entitled to use, such as your own Pro and your employer's Team seat. Never buy or borrow accounts to get around limits. We go through it in having more than one Claude account.
How Shuriken does it#
Shuriken does the folder work for you, then switches between the folders. Each Claude account you add is a source, and each source gets its own config folder with CLAUDE_CONFIG_DIR (and its own Keychain entry on a Mac). Into every folder, Shuriken links the parts you want everywhere: your chat history, settings.json, CLAUDE.md, agents, commands, skills and plugins. Sign-ins are never linked.
Then it does what the aliases can't. Shuriken reads each account's 5-hour and weekly usage, and when the one in use reaches your switch point (99% by default) or Claude reports a limit, it moves your chats to the account with the most room. We call it hot swapping: Shuriken moves your chats to another of your accounts or sources when one nears its limit. A Claude Code chat moves on its next request, and the request that hit the limit is replayed. The decision rules are on the source switching page.
MCP servers go in one list for every project and account, and you sign in to each server once. Free includes two sources, which covers a work and a personal account. If two aliases have started to feel like a part-time job, download Shuriken.
Sources
- Claude Code docs: Environment variables (CLAUDE_CONFIG_DIR) (accessed 22 October 2026)
- Claude Code docs: Authentication (log in with multiple accounts, credential management) (accessed 22 October 2026)
- Claude Code docs: Explore the .claude directory (accessed 22 October 2026)
- Claude Code docs: Connect Claude Code to tools via MCP (accessed 22 October 2026)
- Anthropic Consumer Terms of Service (accessed 22 October 2026)
Frequently asked questions
What does CLAUDE_CONFIG_DIR do?
It moves Claude Code's configuration folder away from ~/.claude. Anthropic's docs say all settings, session history and plugins are then stored under that path, and the saved sign-in is kept per folder too.
Can I run two Claude Code profiles at the same time?
Yes. Each folder has its own sign-in, so two terminals can run claude-work and claude-personal side by side. Each one uses its own account's limits.
Can I set CLAUDE_CONFIG_DIR in a project's settings?
No. Anthropic's docs say project and local settings can't set it. Set it in your shell, in user settings or in managed settings, and write an absolute path in a settings file.
Is it allowed to keep two Claude accounts this way?
Use only accounts you own and are entitled to use. Anthropic's consumer terms forbid sharing your login or making your account available to anyone else.