This project installs a local workaround for switching Claude Code OAuth accounts by updating ~/.claude.json.
Supported user-facing commands:
cc-switchcc-switch <index|email|accountUuid>cc-sync-oauthccs(short alias forcc-switch)ccso(short alias forcc-sync-oauth)/cc-switch/cc-sync-oauth
Supported environments:
- Windows (PowerShell/CMD/Git Bash)
- Ubuntu WSL
- Native macOS/Linux with Node.js
- Claude chat shell mode via
!cc-switchand!cc-sync-oauth
Prerequisites:
- Node.js 18+
- Claude Code already installed and logged in at least once
Install:
./install.cmd./install.shnpx claude-code-multi-accounts installWhat install does:
- copies the Node CLI into
~/.claude/multi-account-switch/bin - installs
cc-switch,cc-sync-oauth,ccs, andccsowrapper commands - adds an
auth_successhook entry to~/.claude/settings.json - adds a
SessionStartreminder hook to~/.claude/settings.json - if
statusLine.commandalready exists, wraps it and prependsuse !cc-switch / !ccsto the existing HUD output - installs global Claude command wrappers in
~/.claude/commands - creates backups under
~/.claude/backups/multi-account-switch-installer
Uninstall:
./uninstall.cmd./uninstall.shnpx claude-code-multi-accounts uninstallUsage:
cc-switch
cc-switch 1
cc-sync-oauth
ccs
ccsoExample shell output:
$ cc-switch
Available Claude accounts:
* [0] Alex Example <alex@example.invalid> - Example Workspace - Pro
[1] Taylor Example <taylor@example.invalid> - Example Workspace - Teams
[2] Jordan Example <jordan@example.invalid> - Example Workspace - Enterprise
Run cc-switch <index|email|accountUuid> to make one of these entries the active oauthAccount.
$ cc-switch 1
Switched active oauthAccount to [1] Taylor Example <taylor@example.invalid> (Teams).
Current account list:
[0] Alex Example <alex@example.invalid> - Example Workspace - Pro
* [1] Taylor Example <taylor@example.invalid> - Example Workspace - Teams
[2] Jordan Example <jordan@example.invalid> - Example Workspace - Enterprise
Claude chat shell usage:
!cc-switch
!cc-switch 1
!cc-sync-oauth
!ccs
!ccsoClaude /command usage:
/cc-switch
/cc-switch 1
/cc-sync-oauth
/cc-switch currently still goes through Claude's command-processing path, so !cc-switch remains the primary deterministic execution path. The slash command is installed now so it can benefit from future improvements in Claude's command handling.
Claude startup reminder:
Claude Code Multi-Account Switcher is available.
Use !cc-switch or !ccs to list/switch accounts.
Use !cc-sync-oauth or !ccso to sync the active account into oauthList.
Platform notes:
- Windows installs
cc-switch.cmdandcc-sync-oauth.cmdinto~/bin, plus Git Bash-friendlycc-switchandcc-sync-oauthwrappers in the same directory. - Short aliases
ccsandccsoare installed alongside the full command names. - Native macOS/Linux installs commands into
~/.local/bin. - WSL also uses the Unix shell wrappers.
- If a shell says
command not foundright after install, restart the shell or runhash -ronce.
Behavior notes:
- The tool updates only
oauthListandoauthAccountinside~/.claude.json. - It preserves stable account ordering instead of moving the active account to the end on every sync.
- It creates a backup before writing.
- If a stored
displayNameis already corrupted, output falls back to the email local part. - The displayed plan type is a best-effort inference from the available account fields.
Warnings:
- This is a local workaround, not an official Claude plugin.
- It mutates internal Claude config files.
- Native macOS/Linux support is implemented, but still needs real-host validation beyond Windows/WSL testing.
- npm packaging is prepared, but npm registry publish still requires npm authentication.
After this:
- npm /
npxrelease refresh forv0.1.2 - non-AI hook execution path for
/cc-switchif Claude exposes a direct command hook in the future - improve plan type detection beyond the current best-effort inference