Skip to content Mohamed Yamani
All blog articles

How to Use Multiple Claude Code Accounts (Work & Personal)

· 1 min read
blue and orange smoke
Picture by Lucas K on Unsplash

At work, we were provided with a generous Anthropic plan to use, it was my first experience with Claude Code, and it was terrific. So I had to get my own account for my projects.

Switching between the accounts was not only tedious, I also lost the entire conversation history between sessions which was frustrating.

Digging online, I found that Claude Code uses the default directory ~/.claude for configuration, where conversation history is stored, which is naturally cleared on log out.

I also found out the flag CLAUDE_CONFIG_DIR that we can use to change the default directory. Documentation explains it as:

Customize where Claude Code stores its configuration and data files

The Setup

I tested the setup below on Ubuntu and macOS, and it worked just fine on both. Windows users, you’re on your own.

Create a directory for each account, in my case I needed two:

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

Add these aliases to your shell configuration (.bashrc or .zshrc, etc.):

# Claude Code
alias cc-work='CLAUDE_CONFIG_DIR=$HOME/.claude-work claude'
alias cc-personal='CLAUDE_CONFIG_DIR=$HOME/.claude-personal claude'

Authenticate each account and follow through the steps:

cc-work
cc-personal

And voilà, the setup is complete.


Mohamed Yamani (yamanidev) smiling
Written by Mohamed Yamani

Software engineer sharing the craft, personal insights, and my journey.

Stay connected

Stay updated with what I'm tinkering with. Follow me on Twitter to connect, ask a question, or chat!

Follow me
Previous: Finding a Way to Keep Up with My Ever-Growing Newsletter Inbox