← Claude Code Hub
✦ Tip #042 Apr 7, 2026

How to Use More Than One Claude Code Profile on the Same Machine

Set CLAUDE_CONFIG_DIR to a different directory and you get an isolated Claude Code: credentials, settings, history, plugins. Switch between profiles with an alias.

TL;DR Set CLAUDE_CONFIG_DIR to a different directory and you get a completely isolated Claude Code: credentials, settings, history, plugins, agents, hooks. Add a shell alias and switch between profiles with one command.

Two Claude Code profiles on the same machine

If you use Claude Code for work and personal projects, mixing contexts is a real problem. Your personal MEMORY.md leaks into work sessions. Your company plugins pollute your personal setup. And if you have two different accounts, logging in and out constantly is ridiculous.

The official solution: CLAUDE_CONFIG_DIR. An environment variable that tells Claude Code where to store ALL its configuration. Point it to a different directory and you have a fully isolated parallel install.

What each profile isolates

Each CLAUDE_CONFIG_DIR independently stores:

  • Account credentials (claude.ai login)
  • settings.json (model, permissions, global hooks)
  • Global CLAUDE.md
  • Session history (/resume)
  • Installed plugins
  • Personal skills (~/.claude/skills/)
  • Personal subagents (~/.claude/agents/)
  • Auto-memory (projects/<repo>/memory/)

It's a complete Claude Code install per directory. Nothing is shared.

Setup

1. Create the second directory

mkdir -p ~/.claude-work

You don't need to copy anything. The first time you launch Claude Code pointing to that directory, it will ask for login and start fresh.

2. Add shell aliases

Add to ~/.zshrc or ~/.bashrc:

# Personal profile (default)
alias claude-personal='CLAUDE_CONFIG_DIR=~/.claude claude'

# Work profile
alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'

Reload your shell:

source ~/.zshrc

3. Use each profile

# Launch with your personal account
claude-personal

# Launch with your work account (different account, plugins, history)
claude-work

The first time you run claude-work, it will ask you to log in. From then on, each profile keeps its own session.

4. Auto-load a profile per project (optional)

If a project always uses a specific account, add a .env at its root:

CLAUDE_CONFIG_DIR=~/.claude-work

And load env vars when you enter the directory (with direnv or similar). Any claude you run from that project will automatically use the right profile.

Reference

Aspect Detail
Variable CLAUDE_CONFIG_DIR
Default ~/.claude
What it isolates Credentials, settings, history, plugins, skills, agents, auto-memory
Typical setup Aliases in .zshrc / .bashrc
Per project .env with direnv or similar
Logout/login Not needed — each profile keeps its session

Official docs: Environment variables — CLAUDE_CONFIG_DIR

Free guide

51 tips to master Claude Code.

One page per tip. Five chapters. What I actually use daily in production — no theory, no fluff.

  • I. Getting started 10 tips
  • II. Awareness 3 tips
  • III. Mastery 22 tips
  • IV. Autonomy 10 tips
  • V. Comparison 6 tips
Are you a professional Web developer?

You'll receive the guide by email · You join the Gravitas newsletter · Unsubscribe anytime

of 51
#

Wmedia · 51 Tips
Free guide · 51 tips · 5 chapters

51 tips to master Claude Code.

Are you a professional Web developer? · Unsubscribe anytime