Multiple accounts in Claude Code: the complete setup A developer documented a method for managing multiple Claude Code accounts by using the CLAUDE_CONFIG_DIR environment variable to create isolated config directories. The approach involves creating separate directories per account, setting shell aliases or a wrapper script, and authenticating each instance independently. The developer also highlighted pitfalls such as fragile absolute binary paths, shared project-level settings, and missing custom hooks in new config directories. You have a personal Claude Code subscription and a work one. Or you freelance for two clients who each provide their own API key. Or you want a sandboxed account for experiments that won't pollute your main config. Whatever the reason, Claude Code doesn't ship with a built-in "switch account" command. But the architecture makes it straightforward: everything lives in a single config directory, and you can redirect it. Claude Code keeps all its state in ~/.claude by default. That includes: .claude/ inside each repo The key insight: the CLAUDE CONFIG DIR environment variable overrides where Claude Code looks for all of this. Point it somewhere else, and you get a completely independent instance. Create one config directory per account: mkdir -p ~/.claude-personal mkdir -p ~/.claude-work Find your Claude binary path: which claude e.g. /Users/you/.nvm/versions/node/v22.15.0/bin/claude Add aliases to your ~/.zshrc or ~/.bashrc : alias claude-personal='CLAUDE CONFIG DIR=~/.claude-personal claude' alias claude-work='CLAUDE CONFIG DIR=~/.claude-work claude' Reload your shell: source ~/.zshrc Then authenticate each one separately: claude-personal run /login inside the session claude-work run /login inside the session Each alias now opens Claude Code with its own auth, memory, and settings. The alias trick works, but it has gaps that will bite you in production use. If you hardcode the binary path in your alias as many guides suggest , upgrading Node via NVM silently breaks it. Use just claude instead of the absolute path, and let $PATH resolve it: fragile alias claude-work='CLAUDE CONFIG DIR=~/.claude-work /Users/you/.nvm/versions/node/v22.15.0/bin/claude' resilient alias claude-work='CLAUDE CONFIG DIR=~/.claude-work claude' Claude Code creates a .claude/ directory inside your project repo. That directory stores project settings, CLAUDE.md , and settings.json . These are shared across all your aliases because they live in the repo, not in the config dir. This means your work account and personal account see the same project-level instructions. That's usually fine, but if you need different MCP servers or permissions per account per project, you'll need to handle it differently see the wrapper script section below . If you've configured custom hooks or MCP servers in ~/.claude/settings.json , those won't exist in your new config directories. You'll need to copy or symlink the parts you want shared: share hooks across accounts ln -s ~/.claude/settings.json ~/.claude-work/settings.json Or, if you want different hooks per account, copy and customize: cp ~/.claude/settings.json ~/.claude-work/settings.json Each config directory has its own memory system. Your personal account won't remember what your work account learned. If you use memory-heavy workflows, that isolation is sometimes a feature, sometimes a problem. Instead of simple aliases, a small wrapper gives you account switching with validation: bash /usr/bin/env bash Save as ~/bin/claude-switch and chmod +x ACCOUNT="${1:?Usage: claude-switch