iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🔀

How to switch accounts in Claude Code

に公開

Switching accounts

This is a method for easily switching Claude Code accounts using aliases. It is useful in the following cases:

  • You need to use both a personal account and a work account on the same PC.
  • You need to use different accounts prepared for each project on the same PC.

This article is expected to become unnecessary once the following issue is resolved:
https://github.com/anthropics/claude-code/issues/20131

The following instructions are for setting it up on a Mac. Please proceed at your own risk.

Procedure

Here, we will set up the configuration assuming you want to switch between personal and work accounts.

Setting up the personal account

Launch the personal Claude and log in with the following command:

CLAUDE_CONFIG_DIR=~/.claude-personal claude

Add the following to your ~/.zshrc:

alias personal-claude='CLAUDE_CONFIG_DIR=~/.claude-personal claude'

Setting up the work account

The steps are the same as above; simply change the names accordingly.
Launch the work Claude and log in with the following command:

CLAUDE_CONFIG_DIR=~/.claude-work claude

Add the following to your ~/.zshrc:

alias work-claude='CLAUDE_CONFIG_DIR=~/.claude-work claude'

Applying changes

source ~/.zshrc

Now, launch Claude Code with work-claude or personal-claude. If checking /status shows that the login information has switched, you are done.

Additionally, if ~/.claude already exists, you can perform just one of the account setups above to use your usual account with the claude command, and use your work account with the work-claude command.

Regarding skills, agents, etc.

If you have a base Claude and want to use it with the other account, you can do so by creating a symbolic link.

Discussion