A simple tool to manage and switch between multiple Claude Code accounts on macOS, Linux, and WSL.
- Multi-account management: Add, remove, and list Claude Code accounts
- Quick switching: Switch between accounts with simple commands
- Cross-platform: Works on macOS, Linux, and WSL
- Secure storage: Uses system keychain (macOS) or protected files (Linux/WSL)
- Settings preservation: Only switches authentication - your themes, settings, and preferences remain unchanged
Download the script directly:
curl -O https://raw.githubusercontent.com/ming86/cc-account-switcher/main/ccswitch.sh
chmod +x ccswitch.sh# Add current account to managed accounts
./ccswitch.sh --add-account
# List all managed accounts
./ccswitch.sh --list
# Switch to next account in sequence
./ccswitch.sh --switch
# Switch to specific account by number or email
./ccswitch.sh --switch-to 2
./ccswitch.sh --switch-to user2@example.com
# Remove an account
./ccswitch.sh --remove-account user2@example.com
# Show help
./ccswitch.sh --help- Log into Claude Code with your first account (make sure you're actively logged in)
- Run
./ccswitch.sh --add-accountto add it to managed accounts - Log out and log into Claude Code with your second account
- Run
./ccswitch.sh --add-accountagain - Now you can switch between accounts with
./ccswitch.sh --switch - Important: After each switch, restart Claude Code to use the new authentication
What gets switched: Only your authentication credentials change. Your themes, settings, preferences, and chat history remain exactly the same.
- Bash 4.4+
jq(JSON processor)
macOS:
brew install jqUbuntu/Debian:
sudo apt install jqThe switcher stores account authentication data separately:
- macOS: Credentials in Keychain, OAuth info in
~/.claude-switch-backup/ - Linux/WSL: Both credentials and OAuth info in
~/.claude-switch-backup/with restricted permissions
When switching accounts, it:
- Backs up the current account's authentication data
- Restores the target account's authentication data
- Updates Claude Code's authentication files
- Check that you have accounts added:
./ccswitch.sh --list - Verify Claude Code is closed before switching
- Try switching back to your original account
- Make sure you're logged into Claude Code first
- Check that you have
jqinstalled - Verify you have write permissions to your home directory
- Make sure you restarted Claude Code after switching
- Check the current account:
./ccswitch.sh --list(look for "(active)")
To stop using this tool and remove all data:
- Note your current active account:
./ccswitch.sh --list - Remove the backup directory:
rm -rf ~/.claude-switch-backup - Delete the script:
rm ccswitch.sh
Your current Claude Code login will remain active.
- Credentials stored in macOS Keychain or files with 600 permissions
- Authentication files are stored with restricted permissions (600)
- The tool requires Claude Code to be closed during account switches
MIT License - see LICENSE file for details