Swap between Claude accounts (Code + Desktop) on macOS with a single command.
Fully offline. Zero storage. No tokens are sent anywhere and nothing is written to disk by csw. All credentials live exclusively in macOS Keychain — the same encrypted, hardware-backed store that Claude itself uses. No config files, no dotfiles, no plaintext secrets.
curl -fsSL https://raw.githubusercontent.com/mtxr/claude-switch/main/install.sh | bashThis downloads the latest release binary for your architecture (arm64 or x86_64) to ~/.local/bin/csw.
Requires Rust.
git clone https://github.com/mtxr/claude-switch
cd claude-switch
cargo install --path .Grab the binary for your architecture from Releases, put it somewhere in your $PATH, and chmod +x it.
Make sure ~/.local/bin is in your $PATH (add to ~/.zshrc if needed):
export PATH="$HOME/.local/bin:$PATH"You also need sk or fzf for the interactive picker:
brew install skIf you were using the previous Python-based csw, your profiles and keychain entries are fully compatible — no data migration needed. The Rust binary reads the exact same Keychain entries and file paths.
The only thing that changes is how csw is installed:
1. Remove the old wrapper
rm ~/.local/bin/csw ~/.local/bin/claude-switch2. Install the new binary
curl -fsSL https://raw.githubusercontent.com/mtxr/claude-switch/main/install.sh | bash3. Verify everything still works
csw whoami
csw listYour profiles should appear exactly as before. Nothing to re-save.
Note:
csw updatenow self-updates by downloading the latest binary from GitHub Releases instead of runninggit pull. If you cloned the repo just for the Python version, you can delete it.
You need to save each account as a profile before you can switch between them. Do this once per account:
1. Save your current account (e.g. work)
csw save workThis saves the session tokens into macOS Keychain and migrates ~/.claude.json and ~/.claude/ to profile-specific paths (~/.claude.work.json, ~/.claude.work/), leaving symlinks in place. From now on, switching just swaps the symlinks.
2. Create a slot for the second account and log in
csw new personal # creates ~/.claude.personal.json + ~/.claude.personal/, activates symlinks
claude auth login # logs in as the personal account into the active slot3. Save the second account
csw save personalYou're set. Switch between accounts instantly:
csw use work
csw use personal
# or interactively:
csw pickcsw save <name> Save current sessions (Code + Desktop) as a named profile
csw use <name> Switch to a saved profile
csw new <name> Create a new empty profile slot (then: claude auth login)
csw delete <name> Delete a profile and its data
csw list List all saved profiles
csw whoami Show active session info (Code + Desktop + saved profiles)
csw pick Interactive fuzzy picker (sk / fzf)
csw update Update csw to the latest release
csw logout-all Log out of all accounts and remove active symlinks
csw does not create any files or directories of its own. All session tokens are stored in macOS Keychain, protected by the same OS-level encryption and access controls that guard your passwords, SSH keys, and certificates.
| Data | Where it lives |
|---|---|
| Claude Code tokens | Keychain: csw-code-<profile> |
| Active Code session | Keychain: Claude Code-credentials (managed by Claude) |
| Active Desktop session | Electron SQLite cookie, AES-128-CBC encrypted (managed by Claude Desktop) |
| Desktop encryption key | Keychain: Claude Safe Storage (managed by Claude Desktop) |
| Profile configs | ~/.claude.<profile>.json + ~/.claude.<profile>/ |
| Active profile | ~/.claude.json → symlink, ~/.claude/ → symlink |
- No network requests are ever made.
- No plaintext tokens ever touch the filesystem.
- Both Claude Code and Claude Desktop are optional — csw works with either or both.
- On switch, Claude Desktop is quit automatically and relaunched.
Switching profiles is instant because ~/.claude.json and ~/.claude/ are symlinks. Changing them is an atomic filesystem operation — no copying, no rewriting.
Claude Desktop uses real directory renames instead of symlinks (Electron doesn't follow symlinks for its data directory). On switch, csw renames Claude/ → Claude.<from>/ and Claude.<to>/ → Claude/.
git clone https://github.com/mtxr/claude-switch
cd claude-switch
cargo build
cargo testCI runs on every push: cargo clippy (warnings are errors) and cargo test.
Releases are built automatically when a tag is pushed:
git tag v0.2.0
git push origin --tagsGitHub Actions compiles arm64 and x86_64 binaries and publishes them to the release.
MIT — see LICENSE.