Use multiple Claude accounts on one machine
I use one Claude account for work and another for personal projects, and I wanted each repo to pick the right one without logging in and out.
Claude Code reads its settings, history, and login from ~/.claude by default.
Setting the CLAUDE_CONFIG_DIR environment variable points it at a different
folder, so each account gets its own config directory.
You could keep changing that variable when you change project directory. Or you
could use mise to automatically set that variable per
directory. In a personal repo, I add a .mise.local.toml:
[env]
CLAUDE_CONFIG_DIR = "{{ env.HOME }}/.claude-personal"
Once mise is activated in your shell, cd-ing into the repo exports the
variable, and claude uses ~/.claude-personal. Outside the repo, it falls
back to the default ~/.claude. The first run in each config directory asks you
to log in, and after that the account sticks.
A few notes:
-
{{ env.HOME }}is mise’s template syntax. A literal~is not expanded. - I use
.mise.local.tomlrather thanmise.tomlfor this. The.localfile is meant for machine-specific settings, and I ignore it globally in git, so the account choice never lands in a shared repo. - Run
mise trustonce in the directory if mise refuses to load the file. - Check which account is active with
echo $CLAUDE_CONFIG_DIRbefore you start a session.
Settings, skills, and memory are no longer shared between accounts. If you want
common instructions in both, symlink the files (for example AGENTS.md) into
each config directory.
Drafted with AI and edited by me.
Leave a comment