Switch Claude Code between multiple accounts, from an animated terminal interface — with weekly, session and spend usage for each one.
Claude Code stores one login at a time. If you have a personal Max plan and
a work seat, moving between them means logging out and logging back in every
time. ccswitch saves each login once and swaps them in place afterwards, so
switching takes a keystroke and no re-authentication.
Homebrew (macOS and Linux):
brew install edglz/tap/ccswitchGo:
go install github.com/edglz/ccswitch/cmd/ccswitch@latestBinary: download from Releases
and put ccswitch on your PATH.
macOS, Linux and Windows are supported. To upgrade later:
brew upgrade ccswitchCheck it found your Claude Code install:
ccswitch doctorcredentials macOS Keychain (Claude Code-credentials)
config /Users/you/.claude.json
secrets macOS Keychain
signed in true
This is the part that takes five minutes, once. After it, switching is instant.
ccswitch can only save the account you are currently signed into, because
that is the only one whose token exists on this machine. So saving two accounts
means signing into each one once, and saving it while it is active.
claude auth status # shows who you are signed in asQuit any running claude session. ccswitch refuses to touch a live one, and
for good reason — see Why it refuses while Claude Code is running.
ccswitch save worksaved work (you@acme.com)
The name is yours to pick — work, personal, client-acme. Leave it out and
the name is derived from the email address:
ccswitch save # saves as "you", from you@acme.comclaude auth logout
claude auth login # complete the browser flow as the OTHER accountccswitch save personalsaved personal (me@example.com)
ccswitch list NAME ACCOUNT PLAN LAST USED
work you@acme.com max never
* personal me@example.com pro never
The * marks the account Claude Code is signed into right now.
Repeat steps 3 and 4 for a third or fourth account. There is no limit.
From here on you never log in again.
ccswitch use work # switch to the work account
claude # start Claude Code as workSwitch back whenever:
ccswitch use personalOr run the interface and pick with the arrow keys:
ccswitch| Command | What it does |
|---|---|
ccswitch |
open the interactive interface |
ccswitch list |
list saved accounts, active one marked * |
ccswitch current |
show the active account and its remaining usage |
ccswitch use <name> |
switch to a saved account |
ccswitch save [name] |
save the account you are signed into now |
ccswitch rm <name> |
delete a saved account and its token |
ccswitch rename <old> <new> |
rename a saved account |
ccswitch doctor |
show where credentials and config live |
ccswitch version |
print the version |
Add --force to use to switch while Claude Code is running. Read the warning
below first.
| Key | Action |
|---|---|
↑ ↓ |
move between accounts |
enter |
switch to the highlighted account (asks to confirm) |
s |
save the account you are signed into now |
d |
delete the highlighted account (asks to confirm) |
f |
arm a forced switch, after one has been refused |
r |
reload |
q |
quit |
Re-save an account if you log in again manually. Signing out and back in
issues a new token; the copy ccswitch holds is then stale. Just run
ccswitch save <name> again with that account active — it overwrites in place
and keeps the name.
Switching away re-saves automatically. Claude Code rotates tokens in the
background, so every ccswitch use re-reads the account you are leaving and
updates its stored copy before swapping. You do not have to think about this;
it is why a profile saved months ago still works, as long as you switch through
ccswitch rather than logging out by hand.
If a saved account ever stops working, the fix is always the same: sign into it
normally, then ccswitch save <name> over it.
The interface shows what Claude Code itself caches for the signed-in account:
- session (5h) and weekly rate-limit windows, with the time until reset
- per-model weekly limits, when your plan has them (
weekly Opus) - spend, when pay-as-you-go credits are enabled on the account
Two honesty rules are built in, because getting them wrong would make the numbers worse than useless:
- Usage for an account you are not signed into is labelled a snapshot,
with its age. It is the last reading taken while that account was active, not
a live number.
ccswitchnever contacts Anthropic, so there is no way for it to know the current figure for an account that is not logged in. - The
this machineline counts tokens across every account, because that is how Claude Code records them. It is never presented as one account's usage.
To refresh an account's numbers, switch to it and run Claude Code once.
ccswitch: Claude Code is running (pid [1601]); quit it first or pass --force
This is not caution for its own sake. Claude Code keeps ~/.claude.json in
memory and rewrites the whole file when it exits. Switch underneath a live
session and that final write puts the old account identity back, while the
credential store still holds the new account's token. The two disagree, and
Claude Code starts failing in ways that look like a broken login rather than a
bad switch.
Quit Claude Code, then switch. --force exists for when you know the session is
idle and about to be killed anyway.
The check matches the process named exactly claude. The macOS desktop app runs
as Claude, with a capital C, and does not hold these credentials, so it is
deliberately not matched.
| What | macOS | Linux / Windows |
|---|---|---|
| Claude Code's live login | Keychain, service Claude Code-credentials |
~/.claude/.credentials.json |
| Claude Code's identity | ~/.claude.json |
same |
| Saved logins (secret) | Keychain, service ccswitch |
~/.ccswitch/secrets/ (0600) |
| Saved logins (metadata) | ~/.ccswitch/profiles/ (0600) |
same |
| Config backups | ~/.ccswitch/backups/ |
same |
| Variable | Effect |
|---|---|
CLAUDE_CONFIG_DIR |
Claude Code's config directory. Honoured, so a non-standard install works. |
CCSWITCH_HOME |
Where this tool keeps profiles, secrets and backups. Default ~/.ccswitch. |
CCSWITCH_CREDENTIALS_BACKEND |
file or keychain. Forces which store Claude Code's live login is read from and written to. |
ccswitch rewrites exactly three things:
claudeAiOauthinside the credential blob — not the rest of it. YourmcpOAuthsessions (Figma, Expo, and any other MCP server) belong to the machine, not the account, and are written back untouched. Copying the whole blob, which is the obvious implementation, silently signs you out of every MCP server on each switch.oauthAccountanduserIDin~/.claude.json.- Caches scoped to the old account, such as
cachedUsageUtilization, which are deleted so the new account does not display the old one's limits.
Project history, MCP server config, permissions and onboarding state round-trip
byte for byte. The previous ~/.claude.json is copied to
~/.ccswitch/backups/ before every write, and the last ten are kept.
Tokens go to the OS keyring where there is one, and to 0600 files where there is not — the same place Claude Code puts them on that platform. The metadata sidecar next to each profile holds no token, so it is safe to paste into a bug report.
There is one known weakness on macOS, written up in SECURITY.md: writing to the Keychain passes the secret as a command-line argument, briefly visible to other users on the same machine.
ccswitch makes no network requests of any kind.
just check # gofmt, go vet, go test -race
just run # run against your real install
just demo # re-record the GIFs (needs vhs)
just snapshot # build the release archives locally (needs goreleaser)Releasing, including the Homebrew tap, is written up in RELEASING.md.
Or without just:
go test ./...
go build ./cmd/ccswitchPorts and adapters. internal/core holds the domain types and the use cases and
imports nothing from internal/adapter; every file, keyring, process and
terminal concern is an adapter behind an interface in internal/core/port. That
is why the switch logic is tested with fakes and never needs a real Keychain.
internal/
core/domain entities: accounts, profiles, credential blobs, usage
core/port the interfaces the core depends on
core/service use cases: capture, switch, list, remove
adapter/
keyring macOS Keychain, and a 0600 file backend elsewhere
credstore Claude Code's live credential blob
configjson ~/.claude.json, rewritten losslessly
vault saved profiles: metadata on disk, secrets in the keyring
procprobe running Claude Code processes
statsfile local token and cost cache
humanize shared formatting
tui the interactive interface
cli the command line
The mark in the header is not ASCII art. The logo outline is embedded as SVG
path data — the same geometry as .github/assets/logo.svg — and rasterised at
runtime into quadrant block characters, so it stays true to the real shape at
any size and can carry the animated colour pulse.
If this saves you some logins: buymeacoffee.com/edggdev
MIT. See LICENSE.
Not affiliated with Anthropic. "Claude" is a trademark of Anthropic, PBC. The mark is used here to identify the tool this program works with.

