{"id":50361231,"url":"https://github.com/mtxr/claude-switch","last_synced_at":"2026-06-11T01:01:16.966Z","repository":{"id":346475938,"uuid":"1187636508","full_name":"mtxr/claude-switch","owner":"mtxr","description":"Swap between Claude accounts (Code + Desktop) on macOS with a single command. Fully offline. Zero storage.","archived":false,"fork":false,"pushed_at":"2026-05-11T00:11:55.000Z","size":59,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-30T01:32:38.540Z","etag":null,"topics":["claude","claude-code","cli"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtxr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-21T00:45:08.000Z","updated_at":"2026-05-11T11:32:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mtxr/claude-switch","commit_stats":null,"previous_names":["mtxr/claude-switch"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mtxr/claude-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtxr%2Fclaude-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtxr%2Fclaude-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtxr%2Fclaude-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtxr%2Fclaude-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtxr","download_url":"https://codeload.github.com/mtxr/claude-switch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtxr%2Fclaude-switch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34177444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude","claude-code","cli"],"created_at":"2026-05-30T01:30:49.667Z","updated_at":"2026-06-11T01:01:16.952Z","avatar_url":"https://github.com/mtxr.png","language":"Rust","funding_links":[],"categories":["Fundamentals"],"sub_categories":["Utility"],"readme":"# claude-switch\n\nSwap between Claude accounts (Code + Desktop) on macOS with a single command.\n\n**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.\n\n## Install\n\n### Option 1 — download binary (recommended)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/mtxr/claude-switch/main/install.sh | bash\n```\n\nThis downloads the latest release binary for your architecture (arm64 or x86_64) to `~/.local/bin/csw`.\n\n### Option 2 — build from source\n\nRequires [Zig 0.16.0](https://ziglang.org/download/) (or install via [mise](https://mise.jdx.dev): `mise use zig@0.16.0`).\n\n```bash\ngit clone https://github.com/mtxr/claude-switch\ncd claude-switch\nzig build -Doptimize=ReleaseSmall\n# binary at: zig-out/bin/csw\ncp zig-out/bin/csw ~/.local/bin/csw\n```\n\n### Option 3 — manual download\n\nGrab the binary for your architecture from [Releases](https://github.com/mtxr/claude-switch/releases), put it somewhere in your `$PATH`, and `chmod +x` it.\n\n---\n\nMake sure `~/.local/bin` is in your `$PATH` (add to `~/.zshrc` if needed):\n\n```bash\nexport PATH=\"$HOME/.local/bin:$PATH\"\n```\n\nYou also need [sk](https://github.com/lotabout/skim) or [fzf](https://github.com/junegunn/fzf) for the interactive picker:\n\n```bash\nbrew install sk\n```\n\n## Migrating from the Python version\n\nIf 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.\n\nThe only thing that changes is how `csw` is installed:\n\n**1. Remove the old wrapper**\n\n```bash\nrm ~/.local/bin/csw ~/.local/bin/claude-switch\n```\n\n**2. Install the new binary**\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/mtxr/claude-switch/main/install.sh | bash\n```\n\n**3. Verify everything still works**\n\n```bash\ncsw whoami\ncsw list\n```\n\nYour profiles should appear exactly as before. Nothing to re-save.\n\n\u003e **Note:** `csw update` now self-updates by downloading the latest binary from GitHub Releases instead of running `git pull`. If you cloned the repo just for the Python version, you can delete it.\n\n## Getting started\n\nYou need to save each account as a profile before you can switch between them. Do this once per account:\n\n**1. Save your current account (e.g. work)**\n\n```bash\ncsw save work\n```\n\nThis 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.\n\n**2. Create a slot for the second account and log in**\n\n```bash\ncsw new personal   # creates ~/.claude.personal.json + ~/.claude.personal/, activates symlinks\nclaude auth login  # logs in as the personal account into the active slot\n```\n\n**3. Save the second account**\n\n```bash\ncsw save personal\n```\n\nYou're set. Switch between accounts instantly:\n\n```bash\ncsw use work\ncsw use personal\n# or interactively:\ncsw pick\n```\n\n## Usage\n\n```\ncsw save \u003cname\u003e    Save current sessions (Code + Desktop) as a named profile\ncsw use \u003cname\u003e     Switch to a saved profile\ncsw new \u003cname\u003e     Create a new empty profile slot (then: claude auth login)\ncsw delete \u003cname\u003e  Delete a profile and its data\ncsw list           List all saved profiles\ncsw whoami         Show active session info (Code + Desktop + saved profiles)\ncsw pick           Interactive fuzzy picker (sk / fzf)\ncsw update         Update csw to the latest release\ncsw logout-all     Log out of all accounts and remove active symlinks\n```\n\n## How it works\n\n### Security model\n\ncsw 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.\n\n| Data | Where it lives |\n|---|---|\n| Claude Code tokens | Keychain: `csw-code-\u003cprofile\u003e` |\n| Active Code session | Keychain: `Claude Code-credentials` (managed by Claude) |\n| Active Desktop session | Electron SQLite cookie, AES-128-CBC encrypted (managed by Claude Desktop) |\n| Desktop encryption key | Keychain: `Claude Safe Storage` (managed by Claude Desktop) |\n| Profile configs | `~/.claude.\u003cprofile\u003e.json` + `~/.claude.\u003cprofile\u003e/` |\n| Active profile | `~/.claude.json` → symlink, `~/.claude/` → symlink |\n\n- No network requests are ever made.\n- No plaintext tokens ever touch the filesystem.\n- Both Claude Code and Claude Desktop are optional — csw works with either or both.\n- On switch, Claude Desktop is quit automatically and relaunched.\n\n### Profile switching\n\nSwitching profiles is instant because `~/.claude.json` and `~/.claude/` are symlinks. Changing them is an atomic filesystem operation — no copying, no rewriting.\n\nClaude Desktop uses real directory renames instead of symlinks (Electron doesn't follow symlinks for its data directory). On switch, csw renames `Claude/` → `Claude.\u003cfrom\u003e/` and `Claude.\u003cto\u003e/` → `Claude/`.\n\n## Development\n\n```bash\ngit clone https://github.com/mtxr/claude-switch\ncd claude-switch\n\n# Debug build (fast compile, leak detection)\nzig build\n\n# Optimised builds\nzig build -Doptimize=ReleaseSafe   # bounds checks on, ~670 KB\nzig build -Doptimize=ReleaseSmall  # smallest binary\nzig build -Doptimize=ReleaseFast   # max speed\n\n# Run tests\nzig build test\n```\n\nCI runs on every push: `zig build` (debug) and `zig build test`.\n\nReleases are built automatically when a tag is pushed:\n\n```bash\ngit tag v0.2.0\ngit push origin --tags\n```\n\nGitHub Actions cross-compiles arm64 and x86_64 binaries (`-Doptimize=ReleaseSmall`) and publishes them to the release.\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtxr%2Fclaude-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtxr%2Fclaude-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtxr%2Fclaude-switch/lists"}