Coffee
← Blog AI Cost Management

Claude Code Switch Account: 4 Ways, Stay Signed In

By FavTray · · Updated

Written by the team behind FavTray, a Mac developer dashboard for the menu bar. We check every app we cover against its own site, docs or a hands-on test, and each post says which.

Short answer: the built-in Claude Code switch account flow is to type /logout, then /login and sign in with the other account in the browser; /status confirms which one is active. To stay signed in to both, add an alias such as alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude' so each account gets its own directory, or save each login once in a switcher.

Checked 14 November 2026 against the Claude Code authentication docs and Claude Code 2.1.325 on macOS.

TL;DR

  • /logout + /login: built in, but a full browser sign-in every time you switch.
  • CLAUDE_CONFIG_DIR aliases: built in and documented by Anthropic for “work and personal accounts”. Each account gets its own directory, settings, history and login. You pick the account when you start claude.
  • claude setup-token: a one-year token for one shell, script or CI job; model requests only.
  • An account switcher (FavTray Pro, claude-swap): save each login once, switch without signing in again.
  • None of these give an account more usage. Each account keeps its own limits; use accounts you own and follow Anthropic’s terms.

Which Claude Code switch account method should you use?

Use /login if you switch once in a while, CLAUDE_CONFIG_DIR aliases if you want two accounts signed in at once, and a switcher if you move between accounts several times a day. Here’s how the four options compare:

MethodBrowser sign-ins per switchAccounts signed in at onceRuns two accounts side by sideBuilt in
/logout + /login11NoYes
CLAUDE_CONFIG_DIR aliases0 (after the first)1 per directoryYesYes
claude setup-token0 (token lasts 1 year)1 per shellYesYes
Account switcher (FavTray Pro, claude-swap)0 (after saving each once)All savedFavTray: no (one default login); claude-swap: yes, with cswap runNo
You want to…Use
Switch once in a while/login
Keep clients strictly separate, run two accounts side by sideCLAUDE_CONFIG_DIR aliases
Pin a script or CI job to one accountclaude setup-token
Move all your Claude Code work to another account from the menu bar, and see each account’s last-known limitsFavTray Pro, or claude-swap if you prefer the terminal

Why switch Claude Code accounts at all?

Most people who switch have two real accounts on one Mac: a personal Pro, Max or Ultra plan and a company Team or Enterprise seat. Work code should run on the work account (its data and admin settings apply), and side projects on your own. Others keep a separate account per client.

Anthropic’s docs describe exactly this case, “work and personal accounts”, and point you at CLAUDE_CONFIG_DIR (Log in with multiple accounts). Note what switching isn’t: a way around limits. Anthropic says advertised Pro and Max limits “assume ordinary, individual usage” (Legal and compliance), and each account’s limits stay its own. If you keep running out on one plan, compare plans in Is Claude Max worth it? instead.

How do you log out of Claude Code?

Type /logout at the Claude Code prompt, or run claude auth logout in your shell. Logging out also resets first-launch setup, so the next claude walks you through sign-in and setup again (Authentication).

Two things can make it look like logout didn’t work:

  • An environment credential is still set. ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, an apiKeyHelper script and CLAUDE_CODE_OAUTH_TOKEN all outrank the /login credential (Authentication precedence). Run unset ANTHROPIC_API_KEY (and the others you use), and remove them from ~/.zshrc.
  • You’re in a different config directory. /logout signs out the directory the session started with. A claude-work alias session has its own login.

How do you switch Claude Code accounts with /logout and /login?

Sign out with /logout, sign in with /login as the other account, then check with /status. Step by step:

  1. In Claude Code, type /logout.
  2. Start claude (or type /login) and choose your account type. Sign in with the other account in the browser. If the browser doesn’t open, press c to copy the login URL.
  3. When the terminal shows Login successful, press Enter.
  4. Type /status. It shows the login method, organisation and email in use.

You can also type /login without logging out; it switches the current session to the new account. Either way, going back means another browser sign-in, because only one login is saved for the default directory. Fine once a month; tedious several times a day.

If you keep saved logins in a switcher, skip /logout: claude-swap’s docs warn that it may revoke the refresh token stored for the account you are leaving, so that saved copy stops working. Use /login or the switcher instead.

How do you stay signed in to work and personal accounts with CLAUDE_CONFIG_DIR?

Give each account its own configuration directory by setting CLAUDE_CONFIG_DIR when you start claude; this is Anthropic’s documented way to keep multiple Claude Code accounts signed in. Add an alias per extra account to ~/.zshrc:

alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'
alias claude-client='CLAUDE_CONFIG_DIR=~/.claude-client claude'

Open a new terminal, run claude-work and sign in once. From then on, claude uses your personal account and claude-work the work one, each with its own settings, session history and claude.ai login or API key.

Good to know:

  • You pick the account at launch. A running session doesn’t move to another directory; quit and start it with the other alias.
  • Everything is separate: settings, CLAUDE.md in the config directory, user-level MCP servers and your /resume history. That’s a feature for client isolation and a chore if you want one setup everywhere (symlinks help).
  • Editors and other tools only use the alias if they launch claude through your shell with that variable set.
  • Console sign-ins without an API key are stored outside the config directory, so separate directories don’t keep two of those apart (per the docs).

Where does Claude Code store your login on a Mac?

On macOS, Claude Code keeps your login in the encrypted Keychain and your account identity in ~/.claude.json. In detail:

WhatWhere (macOS)
TokensKeychain item “Claude Code-credentials”, account = your macOS user name. The value holds claudeAiOauth (access token, refresh token, expiry, plan) and, if you use them, MCP server logins
Who you areoauthAccount in ~/.claude.json (account ID, email, organisation)
Fallback~/.claude/.credentials.json (mode 0600), only when the Keychain rejects the write, such as a locked Keychain over SSH

With CLAUDE_CONFIG_DIR set, Claude Code keys the Keychain entry to that directory, so each directory reads a different entry, and any fallback file goes under that directory too (Credential management). The docs don’t name the Keychain item; the names above, and a separate item named Claude Code-credentials- plus eight hex characters per extra directory, are what we observed in Claude Code 2.1.284, so treat them as observed.

Claude Code refreshes its own access token shortly before it expires and replaces the refresh token when it does (also observed). That’s why copying the Keychain value around by hand goes stale quickly, and why a good switcher takes a fresh copy of the outgoing account every time it swaps. When a login is within three days of expiring, Claude Code warns at startup: Your login expires in 3 days · run /login to renew.

How does claude setup-token help with multiple accounts?

claude setup-token prints a one-year OAuth token that you set as CLAUDE_CODE_OAUTH_TOKEN in one shell or job, pinning it to that account. It runs the same browser authorisation as /login and saves nothing; you set it yourself:

export CLAUDE_CODE_OAUTH_TOKEN=your-token

It needs a Pro, Max, Ultra, Team or Enterprise plan and “can only make model requests”: no Remote Control and no claude.ai connectors, though locally configured MCP servers still work (Generate a long-lived token). The variable outranks your /login credential. If you run /login while it’s set, the current session switches to the new login, but new sessions go back to the token until you remove the variable. It isn’t a switcher, and a year-long token in a dotfile deserves the same care as a password.

What happens to open Claude Code sessions when you switch?

The session where you type /login switches at once; other sessions on the default directory follow after a short Keychain cache, and sessions with their own credential never follow.

  • /login in a session switches that session.
  • Other open sessions on the default directory read the Keychain item again after a short cache. In Claude Code 2.1.284 we observed a cache of about 30 seconds, so open sessions follow a new login within about 30 seconds. Anthropic doesn’t document this, so treat it as observed behaviour that may change.
  • Sessions with their own CLAUDE_CONFIG_DIR, CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY or an apiKeyHelper never follow a switch of the default login; those credentials take precedence (Authentication precedence).

Run /status in a session if you’re unsure which account it’s on.

Is there a one-click Claude account switcher for Mac?

Yes: FavTray Pro switches the Claude Code login from the menu bar, and claude-swap does the same from the terminal. Both swap the default login, so the next request uses the other account without a browser sign-in. We make FavTray, so weigh our take accordingly; multiple Claude Code accounts: the best tools compares the options.

FavTray is a macOS menu bar app of developer and productivity tools, free with daily limits on some tools, and $4.99 once for Lifetime. Its AI usage tracker shows each provider’s session and weekly limits in the menu bar for free. Since 2.0.5, FavTray Pro adds saved accounts to it:

  1. Save the account you’re signed in with. Click the account chip on the Claude card in AI Usage and choose Save current login.
  2. Add the others once. Add account… opens Terminal and runs Claude Code’s own sign-in (claude auth login) in a temporary directory, so your current login isn’t touched. Sign in with the other account in the browser; FavTray saves it.
  3. Switch. Click the chip, pick an account. A toast confirms “Switched Claude to …”, and open Claude Code sessions follow within about 30 seconds.

What it does under the hood, so you can judge it:

  • Only the login changes. FavTray replaces the claudeAiOauth part of the Keychain item in place and updates oauthAccount in ~/.claude.json. MCP server logins in the same item are kept, so you don’t re-authorise them.
  • It waits for Claude Code. A switch takes Claude Code’s own refresh lock, so it can’t land in the middle of a token refresh, then reads the result back and rolls back if anything doesn’t match.
  • Saved copies stay on your Mac, in FavTray’s own Keychain items. Before a swap, FavTray saves a fresh copy of the outgoing account.
  • It never signs in or renews a login for you. Inactive accounts show their last-known limits, from when you last used them (“18% · as of 2 h ago”), so you can see which account likely has room. When you switch back, Claude Code renews the login itself on its next request. An account you haven’t used for a long time may need one more sign-in: FavTray hints at that after about three weeks, and marks an account Sign in again only when the login has actually expired or been revoked.
  • It suggests; it never switches on its own. When the active account passes about 90% of its session or weekly limit and another saved account has clearly more room, you get a notification; click it to switch.
  • It tells you when a switch won’t apply: FavTray warns if CLAUDE_CONFIG_DIR, an API key variable or an apiKeyHelper is set, because those terminals use a different credential.

What a dedicated terminal tool does better: claude-swap needs no menu bar app, fits scripts, and cswap run starts one terminal as a different account. What CLAUDE_CONFIG_DIR does better than any switcher: fully separate settings, history and logins per account. Account switching is part of FavTray Pro, a one-time Lifetime licence (pricing), and it’s included in the 7-day trial. The usage bars themselves stay free.

Can you switch Codex accounts the same way?

Yes. Codex CLI has the same built-in pair, codex logout and codex login, plus codex login status to see the active method (Codex authentication). Codex keeps its login in auth.json under CODEX_HOME (default ~/.codex) or in the OS credential store, and the CLI and IDE extension share one login. FavTray Pro’s account chip works for Codex too. The full walkthrough, including per-account CODEX_HOME aliases, is in how to switch Codex CLI accounts.

How do you check which account is closest to its limit?

Run /status for the account in use, or /usage for its plan usage limits (Commands). To see every provider’s limits in the menu bar without opening a terminal, see Claude Code usage limits on Mac and the Claude usage limit tracker guide. Whichever switching method you choose, keep it to accounts you’re entitled to use.

Sources (checked 14 November 2026): Claude Code authentication, Claude Code legal and compliance, Codex authentication. Keychain naming, refresh behaviour and the ~30-second pickup were observed in Claude Code 2.1.284 on macOS and may change.

Try FavTray Free

One free Mac menu bar app: notch island, ports, keep-awake, clipboard, eye rest, and Claude and Codex limits.

Download Free

Frequently Asked Questions

How do I switch accounts in Claude Code?

Type /login at the Claude Code prompt and sign in with the other account in the browser, or type /logout first to sign out completely. Check the result with /status. To keep two accounts signed in at once, give each its own CLAUDE_CONFIG_DIR with a shell alias such as claude-work, or save each login once in an account switcher.

How do I log out of Claude Code?

Type /logout at the Claude Code prompt, or run claude auth logout in your shell. Anthropic's docs say logging out also resets first-launch setup, so the next time you run claude it walks you through login and setup again. If an ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN variable is set, unset it too, or that credential keeps working.

Can I switch Claude Code accounts without logging out?

Yes. Anthropic documents a separate configuration directory per account: set CLAUDE_CONFIG_DIR, for example with an alias like claude-work, and each directory keeps its own login, settings and session history. Account switchers such as FavTray Pro and claude-swap save each login once and swap the active one without another browser sign-in.

Where does Claude Code store its login on a Mac?

In the encrypted macOS Keychain. The signed-in account's identity (email, organisation) is saved as oauthAccount in ~/.claude.json. If the Keychain rejects the write, for example when it's locked over SSH, Claude Code falls back to ~/.claude/.credentials.json with file mode 0600. With CLAUDE_CONFIG_DIR set, the Keychain entry is keyed to that directory.

Does switching Claude Code accounts give me more usage?

No. Each account has its own plan and its own limits, and nothing is pooled or extended. Switching only changes which of your own accounts Claude Code signs in with, for example your personal Max plan and your company's Team seat. Anthropic says advertised limits assume ordinary, individual usage, so follow its terms for each account.

Can I use two Claude Code accounts at the same time?

Yes. Run each in its own terminal with its own CLAUDE_CONFIG_DIR, or set CLAUDE_CODE_OAUTH_TOKEN in just one shell. A switcher that swaps the default login changes every terminal that uses the default directory, so it suits moving all your work to another account, not running two accounts side by side.