claud-code-account-switcher
v2.2.0
Published
Manage multiple Claude Code accounts with a simple CLI
Downloads
80
Maintainers
Readme
Claude Account Switcher
Switch between multiple Claude Code accounts — seamlessly.
What is this?
Claude Code Account Switcher lets you manage up to 5 separate Claude Code accounts on the same machine — each with its own auth, history, settings, and project data — all through the claude command you already know.
claude work # → switch to work account and launch Claude
claude personal # → switch to personal account and launch Claude
claude # → launch with the currently active accountNo config files to edit. No environment variables to juggle. Just type and go.
How It Works
┌─────────────────────────────────────────────────────────────┐
│ You type: claude work │
│ │
│ 1. Shell function intercepts the command │
│ 2. Reads active account from ~/.claude-active-account │
│ 3. Sets CLAUDE_CONFIG_DIR to that account's directory │
│ 4. Launches the real Claude binary │
│ │
│ Result: Claude opens fully isolated to your work account │
└─────────────────────────────────────────────────────────────┘Each account lives in its own directory. Switching is instant.
Install
npm install -g claud-code-account-switcherRequirements: Node.js 18+, Claude Code CLI, zsh or bash
Quick Start
Step 1 — Run setup
claude-switcher setupThe wizard handles everything:
=== Claude Code Account Switcher — Setup ===
Claude found: /Users/you/.local/bin/claude ✓
Detected existing config directories:
~/.claude-work → suggested name: work
~/.claude-personal → suggested name: personal
? Use these detected accounts? Yes
? Copy ~/.claude settings into each new account? Yes
✓ Cloned settings, plugins, commands (auth tokens removed)
? Which account should be active by default? work
Shell integration added to ~/.zshrc ✓
Done! Run: source ~/.zshrc
Then try: claude workStep 2 — Apply shell changes
source ~/.zshrcStep 3 — Start switching
claude work
# → [work]
# Claude launches with your work account
claude personal
# → [personal]
# Claude launches with your personal accountCommands
Launching Claude
| Command | Description |
|---|---|
| claude | Launch with the currently active account |
| claude <name> | Switch to <name> and launch (e.g. claude work) |
| claude<name> | Shorthand alias — e.g. claudework, claudepersonal |
Account Management
| Command | Description |
|---|---|
| claude who / claude /who | Show the active account and its config dir |
| claude list | List all accounts — active one marked with * |
| claude use <name> | Switch the active account (shows confirmation) |
| claude-switcher add <name> | Add a new account without re-running setup |
| claude-switcher clear-history [name] | Delete sessions and history for an account (interactive if no name given) |
| claude-switcher setup | Re-run the full setup wizard |
Features
- Auto-detection — Setup scans your home directory and pre-fills any existing
~/.claude-*directories as account suggestions - Config cloning — Optionally copy your current
~/.claudesettings (plugins, commands, skills) into each new account. Auth tokens are always stripped — each account authenticates independently - Dynamic aliases —
claudework,claudepersonal, etc. are generated at shell startup from your accounts config. Add a new account and the alias is ready aftersource ~/.zshrc— no manual edits needed - Zero shell pollution —
CLAUDE_CONFIG_DIRis passed only to the Claude subprocess, never exported into your shell environment - Idempotent setup — Running
claude-switcher setupagain detects the existing shell block and won't duplicate it - First-run auto-setup — Type
claudeon a fresh install with no accounts configured and setup launches automatically
Under the Hood
~/.claude-accounts.conf # name=dir registry (one account per line)
~/.claude-active-account # currently active account name
~/.claude-real-bin # path to real claude binary (set at setup)The shell function injected into your profile looks up the active account, sets CLAUDE_CONFIG_DIR, and execs the real binary — no wrappers, no subshells, no side effects.
Example: Three Accounts
claude-switcher setup # configure work + personal
claude-switcher add client # add a third account later
source ~/.zshrc
claude list
# work -> ~/.claude-work
# * personal -> ~/.claude-personal
# client -> ~/.claude-client
claudeclient # switch to client and launch
claude who # Active account: client
claude use work # switch with confirmation promptTroubleshooting
claude: real binary not found
Run claude-switcher setup — it will locate and store the Claude binary path.
No active account
Run claude-switcher setup or claude use <name> to set an active account.
Aliases not available (claudework not found)
Run source ~/.zshrc to reload the shell function and regenerate aliases.
Wrong account is active
Run claude who to check, then claude use <name> or just claude <name> to switch.
Changelog
v2.1.0 — Current
- Works on Windows and WSL now. The setup wizard, account switcher, and shell integration all work natively on Windows (PowerShell) and Windows Subsystem for Linux — not just macOS and Linux.
- PowerShell users get full support. On Windows, setup injects the
claude()function into your PowerShell profile automatically — the same seamless experience bash and zsh users already had. - Reload hints are always right. After setup or adding an account, the command shown to reload your shell matches your actual shell —
source ~/.zshrc,source ~/.bashrc, or. $PROFILEdepending on what you're running.
v2.0.0
- Every account now starts with a clean slate. When you create a new account, your conversation history and sessions stay where they belong — in the account they came from. No more cross-account bleed.
- Want a fresh start on an existing account? Run
claude-switcher clear-historyand pick the account. Everything is wiped cleanly with a confirmation step so you never do it by accident. - Carrying history over is still possible. If you want to bring your history into a new account when setting it up, the setup wizard will ask — just say yes.
v1.2.3
- Switch accounts in one word. Type
claude workorclaude personaland you're in — no config files, no env vars, no friction. - Setup finds your accounts automatically. If you already had multiple Claude config folders, the wizard detects them and offers to use them right away.
- Your settings travel with you. When creating a new account, you can copy your existing settings, plugins, and commands so you don't have to set everything up from scratch.
- Shortcuts out of the box. After setup,
claudeworkandclaudepersonal(and any other account name) work as standalone commands — no extra config needed.
License
MIT — see LICENSE
Built for developers who live in multiple Claude contexts.
