Running two isolated Claude Code setups on one Mac
I need two distinct Claude Code installs – one for my work account, one for my personal one – that never mix credentials, plugins, or history – but still share a few rules like git conventions and generic skills for various tech stacks. Here's my setup.
1. Separate config directories
mkdir -p ~/.claude-personal ~/.claude-work
Claude Code stores everything – auth, settings, plugins, project history – under a config directory (~/.claude by default). The CLAUDE_CONFIG_DIR environment variable overrides it, giving each account a fully independent install.
2. Log in separately
Start the specific session:
CLAUDE_CONFIG_DIR=$HOME/.claude-personal claude
CLAUDE_CONFIG_DIR=$HOME/.claude-work claude
And launch the /login process in both. Each directory keeps its own credentials, isolated from the other.
3. Add shell shortcuts
# ~/.zshrc
alias claude-personal='CLAUDE_CONFIG_DIR=$HOME/.claude-personal claude'
alias claude-work='CLAUDE_CONFIG_DIR=$HOME/.claude-work claude'
4. Share rules without sharing state
CLAUDE.md supports @path/to/file imports, so I keep shared rules in one canonical file:
mkdir -p ~/shared-claude-rules
# ~/shared-claude-rules/GLOBAL.md: git conventions, stack skills, etc.
Each account's own CLAUDE.md imports it with an absolute path:
@/Users/you/shared-claude-rules/GLOBAL.md
Avoid @~/shared-claude-rules/GLOBAL.md – home-directory-style imports are a known bug and may silently fail to load. Run /context after setup to confirm the file actually loaded.
Known limitations
A CLAUDE.md file sitting at the default path gets loaded in addition to your custom one (#30230)
Comments
No comment yet.
A remark, a suggestion? Do not hesitate to express yourself below. Just be courteous and polite, please.