How to run two Claude Code accounts on one computer, and what stays behind
One environment setting gives Claude Code a second login, but your settings, tools and history do not follow, so here is what to move by hand.
The short version
- Setting CLAUDE_CONFIG_DIR to a new folder makes Claude Code start signed out, as a separate account.
- Personal settings, skills, user-level MCP servers and session history stay in the original folder.
- Repo files like CLAUDE.md and .mcp.json are read by both accounts, so shared setup belongs there.
- On a Mac, each folder's login sits in the Keychain, so deleting a folder does not delete its login.
- Codex uses CODEX_HOME instead, and you must create that folder yourself first.
One setting, one new account
Claude Code keeps its state in a single config folder, which by default is a hidden folder called ~/.claude in your home directory. As dev.to reported in a how-to post, you can point an environment variable named CLAUDE_CONFIG_DIR at a different folder, and Claude Code treats that folder as a separate installation with its own login, settings and history.
A fresh folder starts signed out. You launch Claude Code once with the variable set, type /login inside it, and sign in as the second account. After that, you use the variable for the second account and leave it off for your default one.
To save typing, the author suggests a shell alias, a short nickname for a long command, such as claude-work that sets the variable and starts Claude Code. Running /status inside a session tells you which account you are on.
The author builds a Mac app called Offrun that automates this folder bookkeeping, and says so up front. The post states that everything in it works with the plain command-line tools.
Why it matters
Anyone who splits work between a personal plan and a work seat, or who runs out of quota mid-task, can keep the two apart on one machine. The catch is that the second account starts nearly empty, so knowing what does not carry over saves a confusing first hour. It also helps avoid sending client material through the wrong login.
Why bother with two logins
Claude plans limit Claude Code in two ways: a session window that resets every few hours, and a weekly cap. If you run two or three agents at once, one session can hit its limit halfway through a job.
A second account is a way to carry on. The author also describes the opposite use: keep a client repository on a work seat and side projects on a personal plan, so neither eats the other's allowance. Claude Code will not switch between accounts on its own, since by default it knows one login per machine.
What does not come along
The new folder is empty, and most of what you have built up lives in the old one. The post splits things into two groups.
- Per account, in the config folder: sign-in state, a file called .claude.json (user-level MCP servers and per-project state), your personal settings.json and CLAUDE.md, skills, commands, agents, plugins, and session history.
- Shared, in the repository: the project's CLAUDE.md, .claude/settings.json and .mcp.json.
MCP servers, which are add-on connectors that let the agent reach outside services, are the easiest thing to miss. In the author's test, the default folder listed 8 servers, while the new folder reported none configured.
Three ways to fill the gap
The first option is to put shared setup in the repository. Anything in the project's CLAUDE.md, .claude/settings.json and .mcp.json is read by every account, which the author calls the cleanest fix for project-specific needs.
The second is to add user-level MCP servers again under each account, using the same command with the variable set to the second folder.
The third is to use symlinks, which are shortcuts that make one file appear in two places, for the personal files you want shared, such as settings.json, CLAUDE.md and the skills folder. The author warns against symlinking .claude.json, because it holds each account's own state, which is exactly what you want to keep separate.
Mac logins, Codex and handoffs
On a Mac, the sign-in is not a file in the folder. It is stored in the login Keychain, Apple's built-in password vault, with one entry per config folder. So deleting a folder leaves its login behind, and a proper cleanup means removing the Keychain entry too.
Codex, another coding agent, works in a similar way, using a variable called CODEX_HOME. Unlike Claude Code, it will not create the folder for you, so you must make it first or the login command errors out.
You can also have a shell function choose the account by directory, so anything under a work folder starts on the work account. History does not move between accounts, so the author suggests asking the agent that is about to run out to write a HANDOFF.md file covering the goal, what is done, what is left and the files changed. The second account then reads it. Usage for each account has to be checked separately with /usage, since there is no combined view.
What was tested and what was not
The post lists what the author checked. Run and confirmed: an empty folder is signed out, user-level MCP servers do not carry over, the folder-picking function works in zsh, and Codex needs its folder to exist first. The Keychain entries were observed on the author's own machine. Testing was on macOS with Claude Code 2.1.332 and Codex CLI 0.172.0.
Not run end to end: symlinked settings, CLAUDE.md and skills being picked up by the second account, and how /status, /usage and --resume behave per account. The post also says it was drafted with AI and that its commands were run to check results. Treat the symlink advice as plausible rather than proven.
The author adds that each account has its own plan and terms, and suggests checking your provider's rules on how accounts may be used.
What to watch
- Whether the symlink approach for settings, CLAUDE.md and skills holds up in real use, since the author did not run it end to end.
- Whether Claude Code adds a built-in way to switch accounts or see usage across logins.
- How your provider's terms treat multiple accounts on one machine.
Try it
Create a throwaway folder, run Claude Code with CLAUDE_CONFIG_DIR pointing at it, sign in with /login, then run /status and claude mcp list to see what is missing.
More stories
ClaudeSurveySparrow launches MCP so teams can run surveys inside Claude and ChatGPT
ClaudeA Bengaluru trainer's advice for a team's first AI agent: n8n, Claude Code or Codex
ClaudeWhich tool should coordinate your Codex and Claude Code agents? Three questions decide
ClaudeA free Claude Code hook makes the agent flag risky commands before running them
Get The Daily
AI news, explained in 5 minutes a day. Free. The first issue is coming soon.
No password. Unsubscribe any time. Privacy
Say why
Liked it? Say why
Add a line for other readers.
No account needed. We never show your email. Comments with links, ads or abuse are held and not shown. Your comment shows after a quick check.
Sources
The reporting and documents this story is built from. Each link opens the original.
- ReportingDEV Community: the article we sourced dev.to
Written with AI by the SI Agent News Desk from the reporting above. Every number is checked against it.Spot a mistake? Corrections.
