Switch between Claude Code accounts without logging out. Minimal runtime dependencies.
Claude Code only supports one OAuth account at a time. This tool saves and restores credentials so you can switch instantly between personal, work, or team accounts.
# pnpm
pnpm add -g @oakoss/account-switch
# npm
npm install -g @oakoss/account-switchOr build from source:
git clone https://github.com/oakoss/account-switch
cd account-switch
pnpm install
pnpm build
cp dist/acsw ~/.local/bin/Save your current session:
acsw add personalLog into another account via Claude Code, then save it:
acsw add workSwitch between them:
acsw use personal
acsw use workOr use the interactive picker:
acsw| Command | Description |
|---|---|
acsw |
Interactive profile picker |
acsw add <name> |
Save current session as a profile |
acsw use <name> |
Switch to a profile |
acsw <name> |
Shortcut for use |
acsw list (ls) |
List all profiles |
acsw remove <name> (rm) |
Remove a profile |
acsw current |
Show active profile |
acsw repair |
Validate and fix profiles |
acsw env |
Shell integration for auto-switching |
acsw completions <shell> |
Generate shell completions |
# Zsh: add to ~/.zshrc
eval "$(acsw completions zsh)"
# Bash: add to ~/.bashrc
eval "$(acsw completions bash)"
# Fish: save to completions directory
acsw completions fish > ~/.config/fish/completions/acsw.fishCompletions cover subcommands and profile names for use, remove, and bare acsw <profile>.
Automatically switch profiles when entering a project directory:
# Zsh: ~/.zshrc | Bash: ~/.bashrc
eval "$(acsw env --use-on-cd)"
# Fish: ~/.config/fish/conf.d/acsw.fish
acsw env --use-on-cd | sourceThen create a .acswrc in your project root:
{ "profile": "work" }Now when you cd into that directory, acsw switches to the work profile automatically.
- Swaps OAuth credentials (system keyring on macOS/Windows,
~/.claude/.credentials.jsonon Linux) and theoauthAccountfield in~/.claude.json - Never touches
settings.json, memory, plugins, or project config - Saves the current profile back before switching (no stale tokens)
- Warns if Claude Code is running
See docs/ for architecture, usage guide, and design decisions.
pnpm install
pnpm dev -- list # run from source
pnpm test # run tests
pnpm typecheck # typescript type checking
pnpm lint # oxlint
pnpm format:check # oxfmt
pnpm lint:md # markdownlint
pnpm build # compile standalone binary