Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save bitclaw/89e0ce6681fcb8e4c48615de27d96147 to your computer and use it in GitHub Desktop.

Select an option

Save bitclaw/89e0ce6681fcb8e4c48615de27d96147 to your computer and use it in GitHub Desktop.
Manage Multiple Claude Code Accounts

Manage Multiple Claude Code Accounts (macOS, Linux, Windows, WSL2)

Run multiple Claude Code accounts simultaneously without re-authenticating by isolating each account into its own configuration directory using the CLAUDE_CONFIG_DIR environment variable.

This works on:

  • macOS (zsh)
  • Linux (bash/zsh)
  • Windows (PowerShell)
  • WSL2 (recommended for Windows devs)

Why this works

Claude Code reads credentials, usage state, and settings from a config directory. By setting CLAUDE_CONFIG_DIR per command, each Claude instance operates independently — no token overwrites, no forced re-login.


macOS / Linux (zsh or bash)

1. Create separate config directories

mkdir -p ~/.claude-profile1
mkdir -p ~/.claude-profile2
# optional
mkdir -p ~/.claude-profile3

2. Add aliases to your shell config

Edit your shell config:

nano ~/.zshrc   # or ~/.bashrc

Add the following:

# Claude profiles
alias claude-profile1='CLAUDE_CONFIG_DIR=$HOME/.claude-profile1 command claude'
alias claude-profile2='CLAUDE_CONFIG_DIR=$HOME/.claude-profile2 command claude'
alias claude-profile3='CLAUDE_CONFIG_DIR=$HOME/.claude-profile3 command claude'

# Disable default command to avoid mistakes
alias claude="echo 'Use claude-profile1, claude-profile2, or claude-profile3'"

Why command claude? It bypasses shell aliases and ensures the real Claude binary is executed.

Reload your shell:

source ~/.zshrc

3. Authenticate each account once

claude-profile1
# log in with Account 1

claude-profile2
# log in with Account 2

Each account’s credentials are saved independently.


4. Run simultaneously

Open multiple terminal tabs/windows and run:

claude-profile1
claude-profile2

Each instance has:

  • Separate auth
  • Separate rate limits
  • Separate usage tracking

Windows (PowerShell)

1. Create config directories

mkdir $env:USERPROFILE\.claude-account1
mkdir $env:USERPROFILE\.claude-account2

2. Add functions to your PowerShell profile

Open your profile:

notepad $PROFILE

Add:

function claude-account1 {
  $env:CLAUDE_CONFIG_DIR="$env:USERPROFILE\.claude-account1"
  claude
}

function claude-account2 {
  $env:CLAUDE_CONFIG_DIR="$env:USERPROFILE\.claude-account2"
  claude
}

Reload:

. $PROFILE

3. Authenticate & use

Run each function in a separate terminal window:

claude-account1
claude-account2

WSL2 (Recommended for Windows devs)

WSL2 behaves exactly like Linux and is the cleanest way to manage multiple Claude accounts on Windows.

Follow the Linux/macOS instructions, using:

~/.claude-profile1
~/.claude-profile2

Open multiple WSL tabs and run each profile independently.


VS Code Extension (Important Notes)

  • The VS Code Claude extension inherits environment variables from the terminal that launches it

  • To use a specific profile:

    • Launch VS Code from a terminal where CLAUDE_CONFIG_DIR is already set
    • OR configure a VS Code task/launch config with CLAUDE_CONFIG_DIR

Example:

CLAUDE_CONFIG_DIR=~/.claude-profile1 code .

Each VS Code window can then target a different Claude account.


Troubleshooting

Check active config dir:

echo $CLAUDE_CONFIG_DIR

If Claude asks you to re-authenticate:

  • Ensure you are not accidentally calling plain claude
  • Confirm the alias/function is active

Requirements & Notes

  • Requires separate Anthropic accounts (different emails)
  • Ensure this usage complies with Anthropic’s terms
  • Update Claude Code if needed:
npm install -g @anthropic-ai/claude-code

Summary

This approach gives you:

  • Multiple Claude Code accounts
  • Zero credential collisions
  • Parallel usage with different limits
  • Works across macOS, Linux, Windows, and WSL2

Perfect for:

  • Personal vs work accounts
  • Multiple clients
  • Heavy parallel usage

Tip: If you use this daily, keep the default claude command disabled — it prevents accidental logouts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment