Ola-Obaado
← Engineering

Engineering17 min read

How to Run Multiple Claude Code Accounts on One Machine (Work and Personal)

Run your work and personal Claude Code accounts side by side, without logging in and out. A step-by-step guide for macOS, Windows and Linux, with each account locked to its own folder.

Outline

  1. Why run two accounts
  2. How it works
  3. Step-by-step setup
  4. Tips for macOS, Windows and Linux
  5. Locking each account to its folder
  6. Managing the accounts day to day
  7. Limitations: the VS Code panel and file uploads
  8. Adding a UI: VS Code and Claude Desktop
  9. Safety and troubleshooting
  10. Wrapping up

Why run two accounts

You can run a work Claude Code account and a personal one on the same computer, at the same time, without logging in and out. Each account gets its own folder for login, settings and history, and each one only opens inside the code it belongs to.

This matters for a few reasons:

  • Boundaries. Work code stays with the work account, and side projects stay with yours. Your employer's plan pays for work, not your weekend experiments.
  • Separate limits. Each account has its own usage limits. Hitting a limit on one does not stop the other.
  • Separate context. Instructions, MCP servers and permissions can differ. Your work setup can follow team conventions while your personal setup follows your own.
  • No mistakes. You never commit personal experiments with a company account, or open a client repo under the wrong login.

By the end of this guide you will have two commands, claude-work and claude-personal. Each one opens the right account in the right folder.

How it works

Two things control which account Claude Code uses and what it can touch: the config folder and the working folder.

The config folder. By default, Claude Code keeps everything in ~/.claude. If you set the CLAUDE_CONFIG_DIR environment variable, it uses that folder instead. Point it at a different folder and Claude Code behaves like a fresh install, with its own login.

Kept per config folderShared between accounts
Login and credentialsThe Claude Code program itself
settings.json and permissionsProject files and project CLAUDE.md
Global CLAUDE.mdYour git config
MCP servers, custom commands, agentsYour terminal and shell
Session history (--continue, --resume)

The working folder. Claude Code works in the folder you start it from. It can edit files there and in subfolders, and asks before touching anything outside. If you start it in your home folder, it asks to trust your whole home folder, which is far too much access.

The setup below combines both: each command sets its own config folder and starts in its own working folder.

Step-by-step setup

These steps work on macOS, Linux and Windows with Git Bash. You need Claude Code installed and two Claude accounts.

Step 1: Find your shell config file

echo $SHELL
  • Ends in zsh (the macOS default): your file is ~/.zshrc.
  • Ends in bash (Linux, Git Bash): your file is ~/.bashrc.

Step 2: Create two config folders

mkdir -p ~/.claude-work
mkdir -p ~/.claude-personal

Step 3: Decide on two working folders

Pick where your work code and personal code live. This guide uses these examples:

  • Work: ~/dev/work
  • Personal: ~/dev/personal

On Windows Git Bash, drive paths use forward slashes. C:\Users\YOU\dev\work becomes /c/Users/YOU/dev/work.

Step 4: Add two shell functions

Open your config file. On macOS, use .zshrc instead of .bashrc here and in Step 6:

nano ~/.bashrc

Go to the end of the file (Alt + / in nano) and paste this, with your own paths:

# Claude Code: work account
claude-work() {
  ( cd "$HOME/dev/work" && CLAUDE_CONFIG_DIR="$HOME/.claude-work" claude "$@" )
}

# Claude Code: personal account
claude-personal() {
  ( cd "$HOME/dev/personal" && CLAUDE_CONFIG_DIR="$HOME/.claude-personal" claude "$@" )
}

In Git Bash, Ctrl + V does not paste into nano. Use Shift + Insert or right-click and choose Paste. Save with Ctrl + O, then Enter, and exit with Ctrl + X.

The parentheses run each command in a subshell. The folder change and the account setting only apply while Claude Code runs. When you exit, your terminal returns to where it was.

Use functions, not aliases. An alias cannot change folders cleanly, and an alias with the same name as a function breaks it.

Step 5: Make Git Bash load .bashrc (Windows only)

Git Bash reads ~/.bash_profile first, which may not load .bashrc. Run this once:

grep -q "bashrc" ~/.bash_profile 2>/dev/null || echo 'if [ -f ~/.bashrc ]; then . ~/.bashrc; fi' >> ~/.bash_profile

Step 6: Reload your shell

source ~/.bashrc

Opening a new terminal window also works.

Step 7: Log in to each account

claude-work

Claude Code asks whether you trust the folder. Check that the path is your work folder, then choose "Yes, I trust this folder". Type /login inside Claude Code and sign in with your work account in the browser.

Repeat with claude-personal and your personal account. If the browser signs you straight into the wrong account, use a private window or sign out of claude.ai first.

Step 8: Confirm each account

Inside each session, run:

/status

It shows the signed-in account. If it is wrong, run /logout, then /login again.

Step 9: Run both at once

Open two terminal windows and run one command in each. They work side by side without logging each other out.

Tips for macOS, Windows and Linux

The functions are identical everywhere. What changes is the config file, the paths and a few shortcuts.

macOSWindows (Git Bash)Linux
Default shellzshbashbash (usually)
Config file~/.zshrc~/.bashrc (plus Step 5)~/.bashrc
Reloadsource ~/.zshrcsource ~/.bashrcsource ~/.bashrc
Example work path$HOME/dev/work (/Users/you/dev/work)/c/Users/YOU/dev/work$HOME/dev/work (/home/you/dev/work)
Paste text in terminalCmd + VShift + Insert or right-clickCtrl + Shift + V
Paste an image into Claude CodeCtrl + V (not Cmd + V)Ctrl + V, or Alt + VCtrl + V
Command palette in VS CodeCmd + Shift + PCtrl + Shift + PCtrl + Shift + P
Where the login is storedmacOS KeychainConfig folderConfig folder

macOS

  • Edit your config without nano. Run open -e ~/.zshrc to open it in TextEdit, or code ~/.zshrc for VS Code. If code is not found, open VS Code, press Cmd + Shift + P and run Shell Command: Install 'code' command in PATH.
  • Logins live in the Keychain. Claude Code on macOS keeps your login in the Keychain, not the config folder. Recent versions keep a separate Keychain entry for each config folder. If logging in to one account signs the other one out, run claude update and log in to both again. Open the Keychain Access app and search for "Claude Code-credentials" to see one entry per account.
  • See the hidden folders. .claude-work and .claude-personal are hidden in Finder. Press Cmd + Shift + . in your home folder to show them.
  • Drag files from Finder. Dropping a file into Terminal or iTerm2 pastes its path. In the VS Code terminal, hold Shift while dropping.
  • Window titles work. The title line from the "Label your terminal windows" tip works in Terminal, iTerm2 and the VS Code terminal.

Windows

  • Use Git Bash, so you can use the same functions as macOS and Linux. Set it as VS Code's default terminal with Terminal: Select Default Profile.
  • If you prefer PowerShell, define a function in your $PROFILE that sets $env:CLAUDE_CONFIG_DIR, runs claude in a try block, and clears the variable in finally. Otherwise the variable stays set after you exit.

Linux

  • The Git Bash steps apply as written, minus Step 5.
  • Your login is stored as a file inside each config folder, which is another reason to keep those folders out of git and synced drives.

Locking each account to its folder

The functions above always open a fixed folder. That works, but it gives Claude Code access to every project inside that folder at once. A tighter option is to start in whichever project you are in, and refuse to start anywhere else.

claude-work() {
  case "$PWD" in
    "$HOME/dev/work"*)
      CLAUDE_CONFIG_DIR="$HOME/.claude-work" claude "$@" ;;
    *)
      echo "Run claude-work from inside your work folder." ;;
  esac
}

Now you cd into one project first, then run claude-work. Claude Code only gets access to that project.

When one folder sits inside the other

A common layout puts work code inside your general dev folder, for example ~/dev/organizations/company. Without a guard, the personal account can open your work code. Check the work path first, then the personal one:

claude-personal() {
  case "$PWD" in
    "$HOME/dev/organizations/company"*)
      echo "This is a work folder. Use claude-work instead." ;;
    "$HOME/dev"*)
      CLAUDE_CONFIG_DIR="$HOME/.claude-personal" claude "$@" ;;
    *)
      echo "Run claude-personal from inside your dev folder." ;;
  esac
}

The order matters. The case statement uses the first pattern that matches, so the more specific work path must come first.

Giving temporary access to another folder

If a task needs one extra folder, add it for that session only:

claude-work --add-dir "$HOME/dev/shared-library"

Managing the accounts day to day

Give each account its own instructions

Each config folder has its own global CLAUDE.md, which Claude reads at the start of every session:

nano ~/.claude-work/CLAUDE.md
nano ~/.claude-personal/CLAUDE.md

Put team conventions in the work file: your UI library, data-fetching patterns, commit style, review rules. Put your own habits in the personal file. A CLAUDE.md inside a repo still loads for whichever account opens it.

Commit with the right git identity

The Claude accounts are separate, but git is not. Git's includeIf switches your identity by folder. Add this to ~/.gitconfig:

[includeIf "gitdir/i:~/dev/work/"]
    path = ~/.gitconfig-work

On Windows, you can use the drive path, for example gitdir/i:C:/Users/YOU/dev/work/. The trailing slash matters.

Then create ~/.gitconfig-work:

[user]
    name = Your Name
    email = you@company.com

Run git config user.email inside a work repo to confirm.

Label your terminal windows

Add a title line at the start of each function so you can tell the windows apart:

claude-work() {
  printf '\033]0;CLAUDE WORK\007'
  ( cd "$HOME/dev/work" && CLAUDE_CONFIG_DIR="$HOME/.claude-work" claude "$@" )
}

Configure settings and MCP servers per account

Anything you add through one command applies only to that account:

claude-work mcp add ...
claude-personal mcp add ...

The same goes for settings.json, permission rules, custom commands and agents. To start the new accounts with your existing setup, copy what you want from ~/.claude:

cp ~/.claude/settings.json ~/.claude-work/ 2>/dev/null
cp ~/.claude/CLAUDE.md ~/.claude-work/ 2>/dev/null
cp -r ~/.claude/commands ~/.claude-work/ 2>/dev/null

Choose a permission mode per account

Press Shift + Tab inside Claude Code to cycle permission modes. On work repos, you may prefer approving each edit and command yourself. On personal projects, a more automatic mode can save time.

Know what is separate and what is shared

  • Usage limits are per account. If one hits its limit, the other still works.
  • History is per account. claude-work --continue only sees work sessions.
  • Flags still work: claude-work --resume, claude-personal --add-dir ....
  • The program is shared. Running claude update once updates both.

Block the plain claude command (optional)

Plain claude uses the default ~/.claude folder, which is a third profile. To make sure you always pick an account on purpose, add this to your config file:

claude() {
  if [ -z "$CLAUDE_CONFIG_DIR" ]; then
    echo "Use claude-work or claude-personal."
  else
    command claude "$@"
  fi
}

Your two functions set CLAUDE_CONFIG_DIR before calling claude, so they pass straight through.

Limitations: the VS Code panel and file uploads

This setup works fully in the terminal. Two things work differently from what you might expect. If you'd rather have a graphical interface, see Adding a UI: VS Code and Claude Desktop.

The VS Code panel cannot switch accounts

The Claude Code panel in VS Code has no account switcher. Changing its account means logging out and back in.

In theory, the extension's claudeCode.environmentVariables setting could set CLAUDE_CONFIG_DIR per project. In practice, there is an open bug report on GitHub (issue #30538, "VS Code extension ignores CLAUDE_CONFIG_DIR environment variable") saying the extension ignores this variable and always uses the default ~/.claude folder. If you try it, run /status in the panel to check which account it actually uses.

Workaround: keep the panel signed in to the account you use most, and run the other account in VS Code's built-in terminal.

  1. Set Git Bash as the default terminal on Windows: press Ctrl + Shift + P, run Terminal: Select Default Profile and choose Git Bash. On macOS and Linux, the default terminal already works.
  2. Open the terminal with Ctrl + ` (backtick).
  3. cd into the project and run claude-personal (or claude-work).

The panel and the terminal run side by side. Nothing gets logged out.

For this workflow, the "current folder" functions from the locking section fit better than the fixed-folder ones, because they start in the project you already have open.

The terminal has no upload button

In the terminal, Claude reads files straight from your disk, so you point it at a file instead of uploading it.

MethodHow
@ mentionType @ and part of the file name, for example explain @src/api/payments.ts. It autocompletes from your project.
Drag and dropDrag a file from the VS Code sidebar into the terminal. From Windows File Explorer or macOS Finder, hold Shift while dropping onto the VS Code terminal. The path is pasted in.
Type or paste the pathread C:\Users\YOU\Downloads\brief.pdf and list the requirements. Windows, Git Bash and macOS/Linux paths all work.
ScreenshotsCopy the image and press Ctrl + V in Claude Code (Ctrl, not Cmd, on macOS). On Windows, try Alt + V if that does nothing.

Code, text, Markdown, CSV, JSON, PDFs and images all work this way. For Word or Excel files, save as PDF or CSV first for the best results.

Because each account is locked to its folder, files elsewhere (like Downloads) trigger a permission prompt. Approve it, copy the file into the project, or start the session with access to that folder:

claude-personal --add-dir "$HOME/Downloads"

Adding a UI: VS Code and Claude Desktop

The terminal setup above stays exactly as it is. claude-work and claude-personal keep their own config folders and keep working. When you want a graphical interface (clickable diffs, file attachments, a session list), you can open the Claude Code extension for VS Code or the Claude Desktop app. Either one can be signed in to either account, and you can switch between them whenever you like.

How the three surfaces fit together

Each surface keeps its login in a different place, so they never log each other out:

SurfaceWhere its login livesHow to switch account
Terminal: claude-work~/.claude-workRun the other command
Terminal: claude-personal~/.claude-personalRun the other command
VS Code extension panel~/.claude (the default folder)/logout, then /login in the panel
Claude Desktop (Code tab)The Desktop app's own sign-inSign out and back in from the app

Your two shell functions never touch ~/.claude, so that default folder becomes the VS Code panel's own slot. You can sign it in to whichever account you need, and your terminal accounts stay signed in.

If you added the optional block on the plain claude command, keep it. It only affects your terminal. The VS Code panel and Claude Desktop don't go through your shell functions.

Part A: the Claude Code extension for VS Code

Install and sign in to the panel

Install the Claude Code extension from the VS Code marketplace. Open the Claude panel from the Claude icon in the sidebar or editor toolbar, and sign in with the account you want to use first.

The panel always reads from the default ~/.claude folder (see The VS Code panel cannot switch accounts). Treat that folder as belonging to the panel, not to either terminal command.

Switch the panel to the other account

Inside the panel, run:

/logout

Then:

/login

Sign in with the other account, in a private browser window if the browser picks the wrong one. Run /status to confirm. Your terminal sessions are not affected.

Open the right folder quickly

Add these to your config file to open each folder in VS Code with one command:

code-work() { code "$HOME/dev/work" "$@"; }
code-personal() { code "$HOME/dev/personal" "$@"; }

These only open the folder. The panel uses whichever account ~/.claude is signed in to, so check /status when you switch between work and personal.

Both accounts in one VS Code window

The panel holds one account at a time. For the other account, open the built-in terminal with Ctrl + ` (backtick), cd into the project and run claude-work or claude-personal. One account runs in the panel and the other in the terminal, side by side.

Part B: the Claude Desktop app

The Claude Desktop app has Claude Code built into its Code tab, next to Chat and Cowork. It comes with its own copy of Claude Code, so it does not depend on your terminal install, and it has its own sign-in.

Install and sign in to Desktop

Download Claude Desktop from claude.com/download, open it and sign in with the account you want to use first.

Start a session in the right folder

Open the Code tab and start a new session. Set the environment to Local, then click the project folder control next to the environment selector and pick a project inside ~/dev/work or ~/dev/personal.

Use the mode selector under the prompt box to choose a permission mode: Manual, Accept edits, Plan, Auto or Bypass permissions. Desktop remembers the mode per folder, so work and personal projects can keep different defaults.

Desktop also fixes the missing upload button: you can attach files and images straight to a message.

Switch Desktop to the other account

Sign out of the app and sign back in with the other account. Desktop keeps Code tab sessions separately for each account, so each account's session list comes back when you sign in to it again.

Using them interchangeably

Since each surface has its own login, you can mix them however you like:

  • Both UIs at once. The VS Code panel on one account and Desktop on the other. Both stay signed in at the same time, and you can swap them around whenever you want.
  • One UI for everything. Use only VS Code or only Desktop, and switch its account when you switch context.
  • Terminal only. Skip the UIs on days you don't need them. Nothing in the terminal setup depends on them.

Make every surface follow the same rules

The terminal reads your global CLAUDE.md, settings and MCP servers from ~/.claude-work or ~/.claude-personal. The VS Code panel and the Desktop Code tab read their user-level settings from ~/.claude instead, so they don't see the rules you keep in the account folders.

The fix is to keep each account's rules at the project level, which every surface reads:

WhatWhere
Work rules~/dev/work/CLAUDE.md
Work MCP servers.mcp.json inside each work project
Personal rules~/dev/personal/CLAUDE.md
Personal MCP servers.mcp.json inside each personal project
Rules that apply to both accounts~/.claude/CLAUDE.md and ~/.claude/settings.json

Now a work project gets work rules whether you open it with claude-work, the VS Code panel or Desktop.

Your git identity already works this way. includeIf switches by folder, so commits from ~/dev/work use your work email from any surface.

Mind the history split

Each surface keeps its own session history:

SurfaceHistory lives in
claude-work~/.claude-work
claude-personal~/.claude-personal
VS Code panel~/.claude
Claude DesktopDesktop's own session list, per account

A conversation started in one place won't appear in the others. For a long task, finish it on the surface where you started it.

Check the account before you start

Because both UIs can be signed in to either account, take two seconds before you start:

  • VS Code: run /status in the panel.
  • Desktop: check the account shown in the app.
  • Match the folder: the work account in ~/dev/work, the personal account in ~/dev/personal.

The folder locks in your shell functions protect the terminal, but the UIs don't have that guard. This check is the one habit that matters.

Quick reference

Work accountPersonal account
Terminalclaude-work (~/.claude-work)claude-personal (~/.claude-personal)
VS Code panelEither account, one at a time (~/.claude), switch with /logout and /loginSame panel
Claude DesktopEither account, one at a time, switch by signing out and inSame app
Rules~/dev/work/CLAUDE.md~/dev/personal/CLAUDE.md
Git identityyou@company.com via includeIfYour default identity

Safety and troubleshooting

Keep the config folders private

~/.claude-work, ~/.claude-personal and ~/.claude hold your login credentials. Never commit them to git or keep them in a cloud-synced folder like OneDrive or Dropbox.

Never trust your home folder

If Claude Code asks to trust your home folder (for example C:\Users\YOU or /Users/you), choose "No, exit". That gives it access to everything you own. Start it from a project folder instead.

Common problems

ProblemFix
claude-work: command not foundRun source ~/.bashrc (or source ~/.zshrc on macOS). On Git Bash, check Step 5.
Wrong account after loginRun /status, then /logout and /login in a private browser window.
Trust prompt shows the wrong folderCheck the path in the function. Windows paths need the /c/... form in Git Bash.
Function gives a syntax errorDelete any old alias with the same name from your config file.
Plain claude uses the wrong accountYour shell still has CLAUDE_CONFIG_DIR set. Use the subshell functions above, or open a new terminal.
Settings or MCP servers missingThey are per account. Add them again with that account's command.
On macOS, one login signs the other outRun claude update and log in to both accounts again.
VS Code panel is on the wrong accountThe panel uses ~/.claude. Run /logout, then /login in the panel with the right account, and confirm with /status.
Switching the panel's account logged out my terminalYou were using plain claude, which shares ~/.claude with the panel. Use claude-work or claude-personal instead.
VS Code or Desktop ignores my account's CLAUDE.mdThe UIs don't read ~/.claude-work or ~/.claude-personal. Move the rules into ~/dev/work/CLAUDE.md or ~/dev/personal/CLAUDE.md.
A terminal session doesn't show in VS Code or DesktopEach surface keeps its own history. Resume it where you started it, for example claude-work --resume.

Wrapping up

Two config folders and two short shell functions give you clean separation: the right account, in the right folder, with the right instructions and git identity. Once it is set up, you just type claude-work or claude-personal and get to work. When you want a UI, open VS Code or Claude Desktop, sign in to the account you need, and your terminal setup keeps working alongside it.