Running Two Claude Code Accounts on One Machine
If your company gives you a Claude Code seat and you also pay for a personal one, you hit the same wall I did. Claude Code keeps one login at a time. Switching means logging out and logging back in, which kills whatever session you were in the middle of.
There is a much simpler way. It takes about five minutes and after that both accounts stay logged in, side by side.
Why this happens
Claude Code stores everything about your account in one folder. Your login token, your settings, your history, your project state. All of it sits in a single config directory, which is ~/.claude by default (C:\Users\you\.claude on Windows).
One folder means one identity. That is the whole problem.
The fix is an environment variable called CLAUDE_CONFIG_DIR. Point it at a different folder and Claude Code uses that folder instead. Two folders, two logins, two separate usage limits. They never touch each other.
One tip before you start. Do not move both accounts. Leave the one you use most on the default folder so everything you already have keeps working. Only the second account gets a new folder. Fewer moving parts, fewer things to break.
Setting it up on Windows
These steps are for PowerShell. If you run Claude Code inside WSL, skip ahead to the macOS section, since WSL uses the same shell setup.
1. Make a folder for the second account
mkdir "$HOME\.claude-work"
2. Open your PowerShell profile
Your profile is a script that runs every time you open a terminal. Open it with:
notepad $PROFILE
If it says the file does not exist, create it first and then open it:
New-Item -ItemType File -Path $PROFILE -Force
notepad $PROFILE
3. Add a command for the work account
Paste this at the bottom of the file and save:
function claude-work {
$old = $env:CLAUDE_CONFIG_DIR
$env:CLAUDE_CONFIG_DIR = "$HOME\.claude-work"
try { claude @args } finally { $env:CLAUDE_CONFIG_DIR = $old }
}
The try and finally part matters. It puts the variable back to what it was when Claude Code exits, so a plain claude in the same window still uses your personal account.
4. Reload and log in
. $PROFILE
claude-work
Claude Code will run its first-time setup and open a browser for login. Sign in with the work account. The token gets written into .claude-work and your personal login is untouched.
That is it. Open two terminal tabs. Run claude in one and claude-work in the other. Both stay logged in.
Setting it up on macOS and Linux
Same idea, shorter syntax.
1. Make the folder
mkdir -p ~/.claude-work
2. Add an alias to your shell config
Open ~/.zshrc (or ~/.bashrc if you use bash) and add:
alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work command claude'
The word command tells the shell to skip alias lookup and run the real binary. Without it you can end up in a loop if you ever alias claude itself.
3. Reload and log in
source ~/.zshrc
claude-work
Sign in with the work account when the browser opens. Done.
Tying it to a VS Code profile
VS Code has its own profiles feature, and it pairs well with this. A profile is a saved bundle of extensions, settings, keybindings and UI layout. Most people use it to keep a heavy client toolchain out of their personal projects. You can also make it pick the right Claude Code account for you, so you never think about which command to type.
1. Create the profile
Open the command palette (Ctrl+Shift+P or Cmd+Shift+P) and run Profiles: Create Profile. Name it something like Work. You can copy your current profile as a starting point or begin from an empty one and install only the extensions that client needs.
2. Set the config folder inside that profile
With the Work profile active, run Preferences: Open User Settings (JSON). This opens the settings file for that profile only, not your global one. Add the terminal environment for your OS.
Windows:
{
"terminal.integrated.env.windows": {
"CLAUDE_CONFIG_DIR": "${env:USERPROFILE}\\.claude-work"
}
}
macOS:
{
"terminal.integrated.env.osx": {
"CLAUDE_CONFIG_DIR": "${env:HOME}/.claude-work"
}
}
On Linux the key is terminal.integrated.env.linux with the same value.
Now every terminal you open in a Work window already points at the work folder. You just type claude. No alias, no remembering. Open a window on your personal profile and the same claude command uses your personal account.
3. Let the folder remember the profile
VS Code remembers which profile you last used for a given folder. Open your client repo once with the Work profile active, and from then on that repo opens straight into it. This is the part that actually removes the mistakes, because the choice stops depending on you noticing.
The catch you should know about
This works for the integrated terminal. It does not work for the Claude Code sidebar panel. The extension currently ignores CLAUDE_CONFIG_DIR and always reads from the default ~/.claude folder, no matter what your profile says. It is an open bug (issue 30538) and may be fixed by the time you read this, so it is worth checking.
Until then, the practical setup is: keep the account you use most in the sidebar panel, and run the second account from the integrated terminal. Both work in the same window at the same time.
Let Claude Code set it up for you
If you would rather not edit shell files by hand, open Claude Code on the account you already use and paste this prompt:
I want to run a second Claude Code account on this machine
without logging out of the current one.
Detect my OS and shell first, then:
1. Create a config folder at ~/.claude-work (or the Windows
equivalent under my user profile).
2. Add a "claude-work" command to my shell profile that launches
claude with CLAUDE_CONFIG_DIR pointed at that folder. On
PowerShell, restore the previous value of the variable when
the command exits. Show me the exact lines before you write
them, and back up the profile file first.
3. Link my shared setup into the new folder so I don't configure
things twice: skills, custom commands and plugins. Use
symlinks on macOS or Linux and directory junctions on Windows.
Do NOT link credentials, settings.json or projects - those
must stay separate per account.
4. Check whether ANTHROPIC_API_KEY is set anywhere in my shell
config and tell me if it is.
5. Print the settings.json snippet I should paste into a VS Code
profile so its integrated terminal uses the new folder, with
the correct key for my OS.
Then print the two commands I should use from now on, and tell me
what to run to verify it worked.
Read what it proposes before you approve the file edits. It is your shell profile, and a bad line there will annoy you every time you open a terminal.
Things that will trip you up
The new folder starts empty
Your skills, custom commands, plugins, MCP servers and your global CLAUDE.md all live in the original folder. The second account sees none of it.
You can share the parts that are not tied to an account. On macOS or Linux:
cd ~/.claude-work
rm -rf skills commands plugins
ln -s ~/.claude/skills skills
ln -s ~/.claude/commands commands
ln -s ~/.claude/plugins plugins
On Windows, use a junction, which works without admin rights:
Remove-Item "$HOME\.claude-work\skills" -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Junction -Path "$HOME\.claude-work\skills" -Target "$HOME\.claude\skills"
Leave credentials and settings.json alone. The whole point is that those stay separate. I keep projects separate too, so client work and personal work never end up in the same session history.
One thing worth expecting: sharing the plugins folder shares the list of MCP servers, not the logins to them. The second account will see the same servers but has to authorise each one itself. That is correct behaviour, and you would not want it any other way.
An API key will quietly override both
If ANTHROPIC_API_KEY is set in your shell, Claude Code uses that key instead of your subscription, even when you are logged in. If you have that key exported in your profile for some other script, both of your accounts will silently bill the API rather than the plans you are paying for.
Check it:
echo $env:ANTHROPIC_API_KEY # PowerShell
echo $ANTHROPIC_API_KEY # macOS / Linux
If something comes back and you did not want it, remove the export from your profile.
Know which account you are on
Inside a session, run /status. It shows the active identity.
From the shell, check the variable in that window:
echo $env:CLAUDE_CONFIG_DIR # PowerShell
echo $CLAUDE_CONFIG_DIR # macOS / Linux
An empty result means you are on the default folder, which is your personal account.
One honest note
This is for two accounts you actually hold. Your own plan, and a seat your employer assigned to you. It is not a way to share one seat between people, and it is not a trick for getting around usage limits. What it does give you is a clean separation, which matters more than convenience: client code stays on the client account, personal projects stay on yours, and you stop wondering which login you were on when you ran that last command.