How I Set Up Multiple Claude Accounts

How I use multiple Claude accounts on the same machine without repeatedly logging in and out.

Claude code image

In today’s 9–5 and personal-workspace setup, it’s likely you’ve been in the same position as me. I have a Claude developer account that uses an API-based subscription (thanks to Build with Opus 4.7), a subscription-based account, and one from Fielded Inc.

You’re probably wondering how I’m able to use these accounts on the same machine without logging out and back in all day. Here’s my workflow as a Tech Support Engineer by Day; Software Engineer at Night, and the setup takes about five minutes.

I primarily use Neovim for most of my writing and editing. I also navigate file systems through the terminal, so I always use CLI tools as much as I can.

This setup was done using the Claude Code CLI. I had no use for the desktop app, so researching how to use multiple accounts with Claude Desktop wasn’t worth it for me.

Discovery

Claude Code CLI keeps your login, settings, and history in a single folder: ~/.claude. This folder is created when you run the first claude command after installing the CLI or after logging in through the Claude Code desktop app.

When you log in with your work account, that becomes the account used by the desktop app and every terminal session. Switching to your personal account means running /logout, /login, and repeating the whole process later.

That process is tedious for me. And, well, we all know you shouldn’t use company assets for tasks outside the company’s work. This made running both accounts at once impossible.

The API-based account, however, was easy to connect through OpenCode, and that served me until it didn’t.

The fix: a separate config directory

Claude Code reads an environment variable called CLAUDE_CONFIG_DIR, which tells it where to store its data. Point it at a different folder, and you get a completely independent login.

If you’ve already installed the Claude Code CLI, create a folder. You can call it anything:

mkdir -p ~/.claude-second-account

Then launch Claude Code using that directory:

CLAUDE_CONFIG_DIR=~/.claude-second-account claude

Because the folder is empty, Claude Code prompts you to log in. Sign in with your second account, and you’re done.

Your default ~/.claude folder keeps your first account untouched, assuming you already have one configured.

Each time you want to run Claude using a specific account other than the default, use:

CLAUDE_CONFIG_DIR=~/.claude-second-account claude

Make it a one-word command

This depends entirely on whether you enjoy typing that command every time or would rather create aliases in your shell configuration.

Bash or zsh (~/.bashrc or ~/.zshrc)

alias claude-work="claude"
alias claude-personal="CLAUDE_CONFIG_DIR=$HOME/.claude-personal claude"

Fish (~/.config/fish/config.fish)

alias claude-work="claude"
alias claude-personal="env CLAUDE_CONFIG_DIR=$HOME/.claude-personal claude"

This requires reloading your sell and in my case exec fish did the trick

Switching identities doesn’t have to mean logging out. One environment variable and two aliases give you clean separation between work and personal accounts.

The same pattern works for other tools too, such as Expo’s EXPO_TOKEN.