Skip to content
All posts
Tutorial4 min read

Run Two Claude Code Accounts at Once (Personal + Office)

DebuggerMe TeamDebuggerMe TeamJuly 1, 2026
A terminal window open on a laptop with code on screen
Photo by Unsplash
On this page

Claude Code has no built-in account switcher. If you have a personal subscription and an office one, the default flow is a tedious /logout then /login dance every time you change context. There's an open feature request for a proper switcher, but you don't have to wait for it.

Claude Code stores every credential, session, and setting under ~/.claude. Point it somewhere else with one environment variable and you get a second, fully isolated install. Two accounts, both logged in, side by side.

The one variable that does it

CLAUDE_CONFIG_DIR tells Claude Code which directory to read and write its state from. Override it and nothing touches your default ~/.claude.

The plan is simple:

  1. Give each account its own config directory.
  2. Wrap each one in a shell alias so you never type the variable by hand.
  3. Log in once per account. They both stay logged in indefinitely.

Generate your setup

Type your two account names, pick your shell, and copy the result straight into your shell config. The names become both the directory suffix and the command you'll run (claude-personal, claude-office, and so on).

Config generator
Shell:
~/.zshrc
# 1. Create a separate config dir per account
mkdir -p ~/.claude-personal ~/.claude-office

# 2. Add these aliases to ~/.zshrc
alias claude-personal='CLAUDE_CONFIG_DIR=~/.claude-personal claude'
alias claude-office='CLAUDE_CONFIG_DIR=~/.claude-office claude'

# 3. Reload your shell
source ~/.zshrc

If you only want to eyeball the zsh version, here's the canonical shape:

bash
# create separate config dirs
mkdir -p ~/.claude-personal ~/.claude-office

# add to ~/.zshrc
alias claude-personal='CLAUDE_CONFIG_DIR=~/.claude-personal claude'
alias claude-office='CLAUDE_CONFIG_DIR=~/.claude-office claude'

source ~/.zshrc

Log in once per account

Run each alias a single time and authenticate in the browser when prompted:

bash
claude-personal   # opens browser, log in with your personal account

Then, in a separate terminal tab:

bash
claude-office     # opens browser, log in with your office account

That's it. From now on, claude-personal and claude-office each open Claude Code with their own credentials, conversation history, and settings. No repeated logins.

Note

Because fish doesn't support inline VAR=value command syntax, the generator wraps the fish version in env. The behaviour is identical; only the syntax differs.

What's isolated, and what isn't

Each config directory is a complete, separate world. That's the upside and the catch.

StateShared between accounts?
Login / credentialsNo, fully separate
Conversation historyNo, per directory
Settings and preferencesNo, per directory
MCP servers and connectorsNo, set up per directory
Custom slash commandsNo, per directory

The practical consequence: anything you configure in one account, an MCP connector, a custom command, a tweaked setting, won't appear in the other. If you want the same MCP setup in both, copy the relevant files from one config directory into the other.

Warning

If your office account lives on a managed or company laptop, check whether IT policy allows a personal Claude account on the same machine. Nothing here stops you technically, but some endpoint policies restrict it.

Auto-switching per project (optional)

Two aliases are enough for most people. But if your work repos should always use the office account, you can stop thinking about which command to type and let the directory decide.

direnv sets environment variables automatically when you cd into a folder. Drop a .envrc in your work directory:

bash
# ~/work/.envrc
export CLAUDE_CONFIG_DIR=~/.claude-office

Run direnv allow once, and every plain claude invocation inside that tree uses your office login. Step out of the folder and you're back to the default. It's a nice touch for monorepos where you never want to mix accounts by accident.

Tip

Keep a scratch file of which directory maps to which account and what you've configured in each. When the two setups drift, this saves you from debugging a "missing" MCP server that simply lives in the other config dir. A quick Online Notepad tab works for this.

When the switcher ships

Anthropic will likely add a native account switcher eventually, and when it does, this approach still won't hurt: separate config directories remain the cleanest way to keep two genuinely independent environments. Until then, one variable and two aliases get you there.

Set it up once. Forget about logging in again.

Tools in this post

Related Tool

Online Notepad

A free online rich text editor with file upload, download, and line numbering features. Edit text documents directly in your browser.

Try it free
DebuggerMe Team

Written by

DebuggerMe Team

The DebuggerMe team builds developer tools, writes technical content, and helps teams ship better software.

Share this post

Back to all posts

Related Articles

All articles →