Use Multiple Claude Code Accounts with CLAUDE_CONFIG_DIR

6 min read.
Tags: aishelllocal-config

Multiple Claude Code accounts are easier to manage if each account has its own CLAUDE_CONFIG_DIR. That keeps login state, hooks, skills, MCP servers, settings, and CLAUDE.md files apart instead of mixing everything under the default ~/.claude.

Quick answer

Create one config folder per account:

mkdir -p ~/.claude-personal
mkdir -p ~/.claude-work

Add aliases to your shell config:

alias claude-personal='CLAUDE_CONFIG_DIR=$HOME/.claude-personal command claude'
alias claude-work='CLAUDE_CONFIG_DIR=$HOME/.claude-work command claude'

Reload your shell:

source ~/.zshrc

Then open each profile and log in once:

claude-personal
claude-work

After that, use claude-personal for your personal account and claude-work for your work account.

When separate Claude Code profiles are worth it

Use separate config folders when the accounts need different state:

  • personal and work accounts
  • client-specific setups
  • a clean test profile
  • different hooks, skills, MCP servers, or settings

Do not use this to work around account or subscription rules. If you have more than one Anthropic account, make sure that setup is allowed for your situation.

The practical benefit is simple: one profile can change without leaking into the other. Work can have work MCP servers. Personal can have experiments. A broken hook in one folder does not break every Claude Code session on the machine.

How CLAUDE_CONFIG_DIR separates multiple Claude Code accounts

By default, Claude Code uses ~/.claude for global user config.

That folder can include:

  • CLAUDE.md
  • settings.json
  • hooks
  • skills
  • agents
  • commands
  • plugins
  • local app data

When you start Claude Code with CLAUDE_CONFIG_DIR, Claude Code uses that folder instead of ~/.claude.

This:

CLAUDE_CONFIG_DIR=$HOME/.claude-work command claude

starts Claude Code with this config folder:

~/.claude-work

It does not install a second Claude binary. It only changes where that Claude process reads and writes its config.

Create the config folders

Use names you will still understand later:

mkdir -p ~/.claude-personal
mkdir -p ~/.claude-work
mkdir -p ~/.claude-client-a

Names like ~/.claude-account1 work, but they are easy to mix up. ~/.claude-work is harder to misread when you come back to it months later.

Start with empty folders unless you have a reason to copy old config. Copying the whole ~/.claude folder into every profile can drag stale MCP servers, old hooks, and unrelated memory into places they do not belong.

Add aliases for zsh or Bash

For zsh, edit ~/.zshrc:

nano ~/.zshrc

Add:

alias claude-personal='CLAUDE_CONFIG_DIR=$HOME/.claude-personal command claude'
alias claude-work='CLAUDE_CONFIG_DIR=$HOME/.claude-work command claude'

Reload it:

source ~/.zshrc

For Bash, put the same aliases in ~/.bashrc:

nano ~/.bashrc
source ~/.bashrc

I prefer $HOME in the alias because it behaves predictably inside quotes. ~ often works, but $HOME is clearer here.

Why the alias uses command claude

Use this:

alias claude-work='CLAUDE_CONFIG_DIR=$HOME/.claude-work command claude'

instead of this:

alias claude-work='CLAUDE_CONFIG_DIR=$HOME/.claude-work claude'

command claude tells the shell to run the actual Claude Code executable instead of another alias named claude.

That matters if you later add a guard alias:

alias claude="echo 'Use claude-personal or claude-work'"

With command claude, the profile aliases keep working.

Log in to each account

Run the personal profile:

claude-personal

Log in with the personal account.

Then run the work profile:

claude-work

Log in with the work account.

Each one should store its auth and config under the folder from the alias. After that, the same alias should open the same account again.

Verify the active config folder

Because the alias sets CLAUDE_CONFIG_DIR only for the Claude process, do the check from inside that Claude Code session. Ask Claude Code to run:

echo $CLAUDE_CONFIG_DIR

For the work profile, you should see something like:

/Users/you/.claude-work

You can also compare MCP config through the aliases:

claude-personal mcp list
claude-work mcp list

If the two profiles have different MCP servers, the output should differ.

If claude-work is not found, reload your shell or open a new terminal tab. That is usually what happened after editing ~/.zshrc or ~/.bashrc.

Watch out for the default ~/.claude folder

You can launch a session with claude-work, but when you ask Claude Code to edit its own support files, a vague prompt may still send it toward the default ~/.claude path.

These prompts are too loose:

Add this hook to my Claude config.
Create a new Claude Code skill for this workflow.
Update CLAUDE.md with this instruction.

They do not say which Claude config folder should change. The assistant may infer ~/.claude, especially because many examples use that default path.

When the task touches hooks, skills, settings, MCP config, or global CLAUDE.md, name the folder:

Add this hook to my Claude Code work profile.
Use this config directory:
~/.claude-work

Do not modify ~/.claude.

For a skill, give the full path:

Create this skill under:
~/.claude-work/skills/my-skill/SKILL.md

Do not create it under ~/.claude/skills.

For a global profile instruction file:

Update the global CLAUDE.md for this Claude Code profile:
~/.claude-work/CLAUDE.md

Do not modify ~/.claude/CLAUDE.md.

For a project CLAUDE.md, use the repository path:

Update the project CLAUDE.md at:
/Users/you/dev/my-repo/CLAUDE.md

Do not update any global Claude Code config file.

It feels repetitive, but it saves time. The worst version of this bug is when Claude edits a real file successfully, just not the file your active profile reads.

Keep profile files separate by default

I would keep these per profile:

  • credentials and auth state
  • settings.json
  • hooks
  • MCP server config
  • skills
  • account-specific memory

Copy individual files only when they belong in both profiles. A small utility skill might be fine in personal and work. A client-specific MCP server probably is not.

Common mistakes

Installing MCP servers into the wrong profile

This command uses whatever plain claude points to:

claude mcp add context7 -- npx -y @upstash/context7-mcp

For the work profile, run it through the work alias:

claude-work mcp add context7 -- npx -y @upstash/context7-mcp

Then check:

claude-work mcp list

Editing the wrong CLAUDE.md

There are usually two files people mean when they say CLAUDE.md:

  • project instructions: /path/to/repo/CLAUDE.md
  • global profile instructions: ~/.claude-work/CLAUDE.md

Tell Claude Code which one you want.

Forgetting to reload the shell

After editing ~/.zshrc, run:

source ~/.zshrc

or open a new terminal tab.

If claude-work returns command not found, the alias is not loaded in that shell.

References

Final check

Use CLAUDE_CONFIG_DIR when you need multiple Claude Code accounts on the same machine. Make one folder per profile, launch Claude through aliases, verify the folder from inside the session, and name the exact config folder whenever Claude edits hooks, skills, settings, MCP config, or CLAUDE.md.