Claude Code Multiple Accounts: Run Personal and Team Side by Side

On this page
I have three named Claude Code profiles plus the default, and I pick one by typing one word: claude team, claude personal or claude client-a. Under the hood that sets CLAUDE_CONFIG_DIR, which is the variable Anthropic documents for running Claude Code multiple accounts. The rest of this post is the small shell function I wrap around it, the aliases I keep next to it, and the rules I use for deciding which account gets which work.
Short version: one config directory per profile, one login per directory, one claude() function that sets the variable for the command and nothing else. Anything riskier, like bypass mode, gets its own alias so you never type it by accident.
Why one config directory per profile
By default Claude Code keeps everything user-level in ~/.claude: settings, hooks, skills, subagents, session transcripts, auto memory, and your login. Set CLAUDE_CONFIG_DIR and every one of those paths moves to the directory you name instead, and so does ~/.claude.json, the file with account details and personal MCP servers (Claude directory reference).
Anthropic's own authentication page recommends exactly this for staying signed in to several accounts: give each account its own configuration directory. On macOS the stored login is keyed to that directory too, so two profiles do not read the same Keychain entry.
That gives you three things at once:
- Separate logins. A personal subscription and a team seat never share a session.
- Separate history and memory. Transcripts and auto memory live under
projects/inside the profile directory, so what Claude learned on team work does not leak into personal work. If you care how that memory behaves, I wrote about it in Claude Code memory system: 5 practical layers. - Separate user-level config. Different skills, hooks and MCP servers per profile, without a single
settings.jsonfull of exceptions.
What does not change: project files. A repo's .claude/settings.json, .mcp.json and CLAUDE.md are read from the repo, whichever profile you started. Profiles split you, not the project.
Step 1: log in once per profile
Start Claude Code with the variable set, sign in, and repeat for each profile. Per the docs, the first run in a new directory walks you through login and setup:
CLAUDE_CONFIG_DIR="$HOME/.claude-personal" claude
CLAUDE_CONFIG_DIR="$HOME/.claude-team" claude
Use an absolute path. The docs note that ~ and $HOME are not expanded when you put the value in a settings file's env block, so a shell function that expands $HOME before it sets the variable is the safe form.
Step 2: wrap it in a claude() function
Typing the variable every time is how people end up in the wrong account. A function fixes that. This is the one I use, with profile names generalised:
# ~/.zshrc: one Claude Code login per profile
claude() {
case "$1" in
personal|team|client-a)
local profile="$1"; shift
(
export CLAUDE_CONFIG_DIR="$HOME/.claude-$profile"
cd "$HOME/repositories" || exit 1
printf '\033]0;claude (%s)\007' "$profile"
command claude "$@"
)
;;
*)
command claude "$@"
;;
esac
}
What each part does:
case "$1"matches the first word against a fixed list of profile names. Plainclaude, and subcommands such asclaude mcp listorclaude update, fall through to the default~/.claude. I used a list instead of a catch-all so a typo or a subcommand can never be mistaken for a profile.- The parentheses run the block in a subshell.
CLAUDE_CONFIG_DIRand thecdexist only for that one command, so your interactive shell never stays "in" a profile. cd "$HOME/repositories"starts every profile session in the folder that holds my clones. That is a habit from my home repo pattern: agents start where every repo is reachable. Delete the line if you would rather start in the current directory.- The
printfline sets the terminal tab title with the standardESC ] 0 ; title BELescape, so five open tabs say which account they are. command claude "$@"calls the real binary, not the function again, and passes every remaining flag straight through.claude team --agents '...'orclaude personal -p "..."work as if you had typed them on the plain command.
Add the profile names you need to the case line. To add a profile, add its name there and log in once.
Step 3: aliases per mandate
The function picks the account. Aliases pick the mandate: how much Claude may do without asking. Mine:
alias cship='claude --permission-mode bypassPermissions'
alias cteam='claude team'
alias cpersonal='claude personal'
alias cpship='claude personal --permission-mode bypassPermissions'
alias cteamship='claude team --permission-mode bypassPermissions'
cship, cpship and cteamship are the same bypass mode on the default, personal and team profile. You need separate aliases because the profile word has to come first: claude --permission-mode bypassPermissions team would not match the case. The names are short enough to type but unlike claude, so bypass mode is always a deliberate typed choice, never tab-completion muscle memory.
What I ran
I checked the snippet in a clean zsh (zsh -f) with a stub claude script that prints the environment it receives. zsh -n accepts the file. Across five stub invocations, claude team --agents '{}' --dangerously-skip-permissions showed CLAUDE_CONFIG_DIR set to $HOME/.claude-team with the flags passed through unchanged. The personal and client-a runs set their own directories. Plain claude and claude mcp list reached the stub with the variable unset, and afterwards the parent shell still had no CLAUDE_CONFIG_DIR. The aliases expanded to the commands above: cpship ran the personal profile with the bypass flag, and cteamship ran the team profile with the same flag. I did not run the real Claude Code binary in that test, so the login flow itself is verified against Anthropic's documentation, not by this script.
To check a real profile after logging in, run claude auth status --text through the function (claude team auth status --text) and look at the account and the config directory it reports.
How I actually use the profiles
My personal Claude account mostly lives in Claude Desktop for day-to-day personal work. The team accounts I have access to run through the CLI wrapper instead: I log into each one with claude team, claude client-a and so on, then start work in bypass mode with aliases like cteamship. That keeps the personal login out of the terminal path I use for client and employer repos.
For background work I open agent view with claude agents from each profile's terminal. Going through the wrapper, claude team agents sets CLAUDE_CONFIG_DIR for that dashboard the same way a normal session would, so I dispatch and watch sessions under the account that should pay for them. I run it from each profile's terminal rather than assuming one agent view mixes every login.
Each account has a five-hour usage window. Parallel sessions spend that window together, so I keep only one or two tasks running per account and spread extra work across other profiles when I can. That is the practical reason to have more than one team profile wired up, not just separate logins.
Personal vs team: which account gets which work
A rule that holds up: the account follows who owns the repo and who pays for it.
| Work | Profile | Why |
|---|---|---|
| Employer or client repos | team (or client-a) | Billing, seat management and data terms attach to that account, not to your own subscription |
| Your own side projects and experiments | personal | Your own plan, your own history and memory |
| Throwaway tests of new flags or settings | personal | Nothing in it matters if it breaks |
| Parallel background work across accounts | one profile per terminal, then agent view | Each account has its own usage window, so spreading tasks across accounts avoids running one dry |
Two cautions. First, check what your organisation's plan says about data and usage before you move work around. I would not assume a personal plan is allowed for company code. Second, a team admin can set managed settings that block bypass mode; on my own team profiles it works, but check yours first.
Safe use of bypass mode
Bypass mode, started with --permission-mode bypassPermissions or its equivalent --dangerously-skip-permissions, switches off permission prompts. Anthropic's permission modes page is blunt about it: it is for isolated containers and VMs, it offers no protection against prompt injection, and the docs point to auto mode for fewer prompts with background safety checks. So the honest advice is: use it where nothing important is in reach. Here is how to keep it contained:
- Pick the profile first. I run bypass on my team profiles too, so containment matters more there: only on a branch or worktree, no production credentials in the shell, and deny rules in each profile's
settings.json. - Work on a branch or worktree, in a repo with no uncommitted work, so the worst case is
git resetand not a lost afternoon. - Keep production credentials out of the shell that launches it. The agent inherits your environment.
- Keep deny rules. They still apply in every mode, bypass included. A small user-level
settings.jsonin the profile directory is enough:
{
"permissions": {
"deny": ["Bash(git push *)", "Read(./.env)"]
}
}
Treat deny rules as a guardrail, not a wall: the docs point out that a rule like Bash(git push *) does not match a push written another way, such as git -C . push.
- Do not run it as root. On Linux and macOS, Claude Code refuses bypass mode as root or under
sudo.
The first time you start bypass mode, Claude Code asks you to accept a warning and stores the acceptance in the settings file. Because that file now lives in the profile directory, expect to see the dialog once per profile.
FAQ: Claude Code multiple accounts
Can I be logged in to two Claude Code accounts at the same time?
Yes, if each account has its own configuration directory. Anthropic's authentication docs describe this setup: set CLAUDE_CONFIG_DIR to a different directory per account, and each directory keeps its own settings, session history and login. The one exception in the docs: two Claude Console sign-ins without an API key are not kept apart, because that kind of sign-in is stored outside the configuration directory.
How do I check which account a Claude Code session is using?
Run /status inside a session, or claude auth status --text from the shell. Both show the account, and the JSON form of claude auth status includes a configDirectory field (Claude Code v2.1.268 or later), so you can confirm the profile directory as well as the login.
Does CLAUDE_CONFIG_DIR change project settings in my repos?
No. It moves the user-level directory, the one that is ~/.claude by default. A repository's own .claude/settings.json, .mcp.json and CLAUDE.md are read from the repo whichever profile you start, so a project rule applies to both of your accounts.
Is bypass permissions mode safe to alias?
It is safe to alias only if you treat it as a deliberate choice, not a default. Anthropic's docs say the mode disables permission prompts, offers no protection against prompt injection, and is meant for isolated containers and VMs. Deny rules still apply in it, and an admin can block it in managed settings.
Can I use a different profile per project automatically?
Not with this setup, and I do not try. The wrapper takes the profile as the first word, so the choice stays visible in your shell history. If you want it automatic, a tool like direnv could set the variable per directory, but I have not tested that, so I do not recommend it here.
Stay in the loop
Productivity tips, tool reviews and early access to new products, straight to your inbox.