DEV Community

Cover image for How to use two instances of Claude Code
Ibrahima D.
Ibrahima D.

Posted on

How to use two instances of Claude Code

You have reached the limit for Claude Code

It's quite frustrating, especially since it often happens when our treatment isn't finished.
It's not ideal to have two instances of Claude, because it means paying for Claude Pro twice, but it's cheaper than having Claude Max, which costs over €100.

First, at the root of your account, create a new folder that will hold your Claude configurations, credentials, etc.

If you have specific configurations such as commands, don't forget to copy them. That's what I do when I activate another instance of Claude.

cp -R .claude .claude-2

in zshrc $HOME/.zshrc|.bashrc

cc() {
 claude
}

ccp() {

CLAUDE_CONFIG_DIR=~/.claude-2 claude

}
Enter fullscreen mode Exit fullscreen mode

Now you just need to launch cc for claude or ccp for claude-2.

Note: cc and ccp are arbitrary you can call them whatever you want.

Enjoy

Top comments (2)

Collapse
 
yamanidev profile image
Mohamed Yamani

Thanks for sharing! Unfortunately CLAUDE_CONFIG_DIR is not present in the documentation, but you can find it in GitHub issues referenced by repository contributors.

I'm wondering why you went with bash functions instead of aliases? I personally went with the latter, and just today discovered that we can also use functions for that.

Collapse
 
ibrahimdans profile image
Ibrahima D.

Thanks! Good catch on CLAUDE_CONFIG_DIR β€” it's only in the GitHub issues, not the official docs yet. I'll add a note about it πŸ‘
For functions vs aliases: honestly both work here !
An alias like alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude' forwards args just fine.
I went with functions just for flexibility β€” easier to add logic later (cd into a workspace, set multiple vars…) and they behave better inside scripts.
but for the basic setup they're equivalent πŸ™‚