All articles

Running Two Claude Code Accounts on One Machine

I keep two Claude Code accounts on one laptop — a personal one and a work one — and I run both at the same time, in two terminals, side by side. Out of the box that isn't possible. This post is about why, and the small trick that makes it work.

The pain point: one machine, one account

By default, Claude Code keeps everything in a single folder: ~/.claude. Your login sits there in .credentials.json, next to your settings.json, your MCP server config, your project history, and your todos. One folder, one identity.

That's fine until you have a second account. Most people hit this the same way I did: a personal subscription for side projects, and a separate work account tied to a company — different plan, different usage limits, different rules about which MCP servers and tools are allowed.

With everything living in ~/.claude, the two accounts fight over the same space:

  • You can only be logged into one at a time. Switching means logging out of one and back into the other. Do that several times a day and it gets old fast.
  • You can't run them in parallel. I often want a long work task running in one terminal while I poke at a personal repo in another. Same config folder means same account in both windows — no way to split them.
  • Settings and permissions bleed together. My work account has stricter permission rules and a different set of MCP servers than my personal one. One shared settings.json can't be both at once.
  • History and usage get mixed. Project sessions, command history, and the usage that counts against a plan's limits all pile into one place. When work and personal share an account, you can't tell them apart — or bill them apart.

The root cause is simple: Claude Code assumes one config folder per user. So the fix is to give it more than one.

The fix: a second config folder

Claude Code reads an environment variable, CLAUDE_CONFIG_DIR, that tells it where its config folder is. Leave it unset and it uses ~/.claude. Point it somewhere else and Claude Code treats that folder as a completely separate home — its own login, its own settings, its own history, its own MCP servers.

That's the whole idea. One extra folder, one environment variable, and you have two independent accounts that don't know about each other.

Here's my actual setup. I made a second folder, ~/.claude-adt (the adt is my company), and added two aliases to my shell config:

alias cl='claude'
alias cla='CLAUDE_CONFIG_DIR=~/.claude-adt claude'
  • cl — plain claude, using the default ~/.claude. This is my personal account.
  • cla — the same claude, but with CLAUDE_CONFIG_DIR pointed at ~/.claude-adt. This is my work account.

Now cl and cla are two different people as far as Claude Code is concerned.

Log in once, then run both at once

The first time you run cla, Claude Code sees an empty config folder and walks you through login — just like a fresh install. You sign in with the second account. From then on, its credentials live in ~/.claude-adt/.credentials.json, entirely separate from the personal login in ~/.claude/.credentials.json.

That separation is the payoff. Because each account's login is its own file, both stay logged in at the same time. No more logout-login dance. I open one terminal and type cl for personal work, open another and type cla for work work, and they run in parallel without stepping on each other.

If I peek at the two folders, the split is obvious:

~/.claude/.credentials.json        # personal login
~/.claude/settings.json            # personal settings + MCP

~/.claude-adt/.credentials.json    # work login
~/.claude-adt/settings.json        # work settings + MCP

Two logins, two settings files, zero interference.

Share what you want, isolate what you must

Full isolation is the default, but you don't have to duplicate everything. Some things are personal to each account — your login, obviously — but others you'd rather keep identical across both, like your writing style rules or your global CLAUDE.md instructions.

The trick is a symlink. In my second folder, CLAUDE.md isn't a real file — it points back at the one in my main folder:

ln -s ~/.claude/CLAUDE.md ~/.claude-adt/CLAUDE.md

Now I write my global instructions once, and both accounts read the same file. Edit it in one place and both pick up the change. Meanwhile credentials and settings stay as separate real files, exactly as they should.

So the rule of thumb:

  • Keep separate — anything account-specific: .credentials.json, settings.json, project history, usage.
  • Share via symlink — anything you want identical everywhere: CLAUDE.md, and optionally shared slash commands or agents.

You get to draw the line wherever you like.

Know which account you're in

The one real risk with two accounts is losing track of which one you're driving. Running a work task on your personal plan — or the reverse — is an easy mistake when both terminals look the same.

A couple of habits help:

  • Name them clearly. cl and cla are short, but the extra letter is a constant reminder. Pick alias names you won't mix up.
  • Put the account in your status line. Claude Code's status line can show which config folder is active, so a glance tells you whether you're personal or work.
  • Use different terminal themes or tabs for each, so the split is visual too.

A few caveats

  • Each folder is a fresh setup. The second account starts empty — you log in again, re-add your MCP servers, and re-do any settings you care about. That's the price of real isolation, and you only pay it once.
  • Disk and updates. Each config folder holds its own history and caches, so they grow independently. The claude binary itself is shared — you're only duplicating config, not the program.
  • This is for separate accounts, not a hack around limits. Two folders means two real logins to two real accounts. It doesn't multiply what a single plan gives you.

The whole thing, in one place

# one-time setup
mkdir -p ~/.claude-adt

# in your shell config (e.g. ~/.bashrc or an alias file)
alias cl='claude'                                   # personal → ~/.claude
alias cla='CLAUDE_CONFIG_DIR=~/.claude-adt claude'  # work     → ~/.claude-adt

# optional: share global instructions across both
ln -s ~/.claude/CLAUDE.md ~/.claude-adt/CLAUDE.md

# then, once each:
cla        # first run logs you into the second account

Two accounts, one laptop, both live at the same time. The default setup assumes one identity per machine — but a single environment variable is all it takes to break that assumption cleanly.

Comments

Be the first to comment.