claude-switch
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Basarisiz
- rm -rf — Recursive force deletion command in app/build.sh
- rm -rf — Recursive force deletion command in install.sh
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Switch accounts in Claude Desktop on macOS while keeping your local Code and Cowork chats shared
Claude Switch
English | Русский
Switch accounts in Claude Desktop on macOS while keeping your local chats shared.
A native menu bar app with Liquid Glass, usage limits at a glance, and a CLI.
Normally, if you sign out of Claude Desktop and sign in with another account, the Code (and Cowork) tab comes up empty, because local sessions are tied to the account. Claude Switch remembers the sign-ins of several accounts and switches between them with one click in the menu bar. All your local chats move with you to whichever account is active.
You can also do everything from the terminal:
$ claude-switch list
● main c4d2a3b1/fb6c95e4 active ← workspace
work 9a1e77f0/2b4d1c88 sign-in saved
$ claude-switch use work
[12:04:10] Quitting Claude… (confirm if the app asks)
[12:04:13] Sign-in for 'main' saved
[12:04:13] Moving workspace c4d2a3b1/fb6c95e4 → 9a1e77f0/2b4d1c88
[12:04:13] Switched to 'work'. Launching Claude.
- Lives in the menu bar. A Control Center-style glass panel shows who you're signed in as, your 5-hour and weekly limits, and every account one click away.
- Usage limits for every account. The current session (5-hour) and weekly limits with reset times and a weekly trend. Turn on Live usage to have them refreshed every couple of minutes.
- One-click switching. From the menu bar, the app window, or
claude-switch use <name>. - Shared local workspace. Code and Cowork sessions, scheduled tasks, sidebar groups and sections, per-folder permission modes and session presets move with every switch. Sessions left behind under another account or organization are gathered back.
- No signing in again. Each account's sign-in is saved locally and restored when you switch back.
- Backup before every change. The last 8 are kept in
~/.claude-switch/backups/. - Native and light. SwiftUI with real Liquid Glass on macOS 26 and later (vibrancy on older systems); the switching engine is one Python file with no dependencies.
[!IMPORTANT]
This is an unofficial tool and is not affiliated with Anthropic. It relies on Claude Desktop's internal data layout, which may change in a future update. Tested with Claude Desktop 4.4212 on macOS (Apple Silicon).
Contents
- Requirements
- Installation
- Quick start
- Commands
- The Claude Switch app
- Building from source
- What is shared and what isn't
- How it works
- Backups and recovery
- Troubleshooting
- Security and privacy
- Updating and uninstalling
Requirements
- macOS 13 Ventura or later (Liquid Glass needs macOS 26 Tahoe or later)
- Claude Desktop in
/Applications - Python 3.8+. It comes with the Xcode Command Line Tools; if you don't have them, run
xcode-select --install
Installation
Run this in Terminal:
curl -fsSL https://raw.githubusercontent.com/qxlies/claude-switch/main/install.sh | bash
The installer:
- downloads the Claude Switch app (universal: Apple Silicon and Intel) from the latest release into
~/Applicationsand starts it, so its icon appears in the menu bar; - puts the
claude-switchcommand in~/.local/binand adds that folder to yourPATH(in~/.zshrc) if needed.
git clone https://github.com/qxlies/claude-switch.git
cd claude-switch
CLAUDE_SWITCH_SRC=./claude-switch ./install.sh
To use an app you built yourself, pass it to the installer: CLAUDE_SWITCH_APP_ZIP=app/build/ClaudeSwitch.zip. See Building from source.
Quick start
In the app
- Click the Claude Switch icon in the menu bar and choose Open Claude Switch (the window icon), or open the app from Spotlight.
- Click Save current account and give it a name, for example
main. - Click + Add account, type a name, and press Continue. Claude reopens on the sign-in screen: sign in with the second account with claude.ai. The app notices the sign-in and moves your chats over.
- From now on, switch from the menu bar: hover an account and click Switch.
In the terminal
[!WARNING]
Run these commands from a regular Terminal, not from Claude's built-in terminal or chat: switching quits and relaunches Claude. If you do run it from inside Claude, nothing breaks (the work continues in the background), but the window showing the output closes.
1. Remember your current account. Claude is not restarted.
claude-switch save main
2. Add a second account.
claude-switch add work
Claude quits and reopens on the sign-in screen. Sign in to the second account with claude.ai. The script notices the sign-in, moves your chats to the new account and relaunches Claude. If you don't sign in within 15 minutes, it restores the previous account.
3. Switch.
claude-switch use main
claude-switch use work
Commands
| Command | What it does |
|---|---|
claude-switch |
List profiles and show a command summary |
claude-switch list |
List profiles: ● is the current sign-in, ← workspace is where your chats are now |
claude-switch save <name> |
Save the current sign-in as a profile; if it's already saved, rename it |
claude-switch add <name> |
Add a new account through the sign-in screen |
claude-switch use <name> |
Switch to a profile |
claude-switch sync |
Move chats to the account that is signed in now (if you signed in outside the script) |
claude-switch rename <old> <new> |
Rename a profile |
claude-switch status |
Print the full state as JSON (accounts, limits, workspace); the app uses this |
claude-switch remove <name> |
Remove a profile: only its saved sign-in, chats are not touched |
claude-switch gui |
Simple account menu in a macOS dialog (fallback without the app) |
claude-switch update |
Update to the latest version |
claude-switch uninstall [--purge] |
Uninstall; --purge also removes profiles and backups |
claude-switch --version |
Show the version |
use, add and sync accept --force: if Claude doesn't quit within a minute (for example, a confirmation dialog is open), the script ends it with SIGTERM.
Profile names can contain letters, digits, -, _ and ., with no spaces.
The Claude Switch app
Menu bar panel
Click the icon in the menu bar (it can also show the active account's weekly usage next to it). A floating glass panel, styled like Control Center, opens over a soft blur of whatever is behind it, with:
- who you're signed in as, how many shared chats there are, and whether Claude is open;
- usage limits: the current 5-hour session and the weekly limit, when each resets, and how fresh the reading is (⚡ Live turns on live usage);
- your accounts, each with its own limits; hover one and click Switch;
- + Add account, settings and quit.
While a switch is running, the panel shows its progress. If you signed in to another account directly in Claude, Claude moved to another organization, or some chats were left under another account, it offers to move your chats.
Main window
Open it from the panel or from Spotlight. The sidebar lists your accounts; for each one you see:
- usage rings for the 5-hour and weekly limits and a weekly trend;
- the shared workspace: Code chats, Cowork sessions, last activity and tokens used today;
- Switch to … (or Open Claude for the active account) and a … menu with Rename, Backups, Log and Remove.
Settings has: launch at login, show weekly usage in the menu bar, keep the icon in the Dock (by default it appears only while the window is open), Live usage, and installing the claude-switch command.
Usage limits and Live usage
By default, limits come from Claude Desktop's own readings (plan-usage-history.json). Claude only takes them while its own usage display is on and you've opened it recently, so they can be hours old even while you use Claude. A 5-hour reading whose window has already reset is shown dimmed.
Live usage (off by default; turn it on in Settings or with ⚡ Live in the panel) asks Anthropic directly, about every 2 minutes and each time you open the panel:
- The first time, macOS asks whether Claude Switch may use the "Claude Safe Storage" key from your Keychain. Allow it (Always Allow keeps it from asking again until Claude Switch is updated). Claude Switch uses it to read the sign-in tokens that Claude Desktop already keeps.
- It reads the active account's token, plus the tokens of saved accounts that are still valid. Tokens stay in memory and are sent only to
api.anthropic.com, the same request Claude Desktop makes for its own usage display. - Readings are saved to
~/.claude-switch/live-usage.json, soclaude-switch listandstatusshow them too. - If you deny the Keychain request, Live usage turns itself off and nothing else changes.
[!NOTE]
The first time you switch, macOS asks whether Claude Switch can control Claude. Allow it, otherwise it can't quit and relaunch Claude.
What is shared and what isn't
| Moves between accounts | Stays with its account |
|---|---|
| Local Code sessions (your whole chat history) | Chats on claude.ai and in the cloud |
| Cowork sessions and scheduled tasks | Cloud sessions and Remote Control |
| Sidebar groups and sections in Code | Organization connectors and MCP servers |
| Per-folder permission modes, session presets | The account's usage limits and plan |
| Sessions' scratch folders | Gateway (3P) mode sessions, which use a separate data folder |
Claude Code transcripts live in ~/.claude/projects and don't depend on the account, so they are always shared.
The claude terminal command (Claude Code CLI) is not affected: it has its own sign-in.
How it works
Details for the curiousClaude Desktop keeps its data in ~/Library/Application Support/Claude.
Sign-in consists of the claude.ai cookies (the Cookies file, sessionKey*), the web storage (Local Storage, Session Storage, IndexedDB) and the oauth:tokenCache* keys in config.json. All of it is encrypted with the "Claude Safe Storage" Keychain key, which is the same for every account on this Mac. So a sign-in snapshot can be saved and put back while the app is closed.
Local sessions live in
claude-code-sessions/<account ID>/<organization ID>/
local-agent-mode-sessions/<account ID>/<organization ID>/
Another account looks for sessions in another folder, which is why they "disappear". A symlink won't do: the app opens these folders with O_NOFOLLOW and treats a symlink as tampering. So on each switch the folder is physically moved under the new account's IDs (rename, instant). If files conflict, the workspace being carried wins and the other copy goes into the backup.
The organization ID can change under you too (Claude follows the organization you last used on claude.ai), and sessions created while signed in outside the script land in that account's own folder. So every switch and sync checks which organization Claude reports, then gathers sessions from the folders of every saved account. Scheduled tasks are merged rather than replaced. Sidebar sections and other per-account settings are stored in claude_desktop_config.json under the account and organization IDs, and are copied to the new pair.
What use does:
- Quits Claude gracefully (AppleScript
quit). - Refreshes the snapshot of the current account's sign-in. Tokens get refreshed over time, so the snapshot is taken on every switch.
- Backs up configs and sessions.
- Restores the target account's sign-in and sets
lastKnownAccountUuidto it. Without this, the app decides a different person signed in and wipes its token cache and connectors. - Moves the workspace and copies the per-account settings.
- Sets the mode choice to claude.ai and launches Claude.
About Gateway (3P) mode. If Gateway is configured in Claude Desktop, an app started without a claude.ai sign-in switches itself to Gateway (the deploymentMode flag in ~/Library/Application Support/Claude-3p/claude_desktop_config.json). The script sets deploymentMode: "1p" and launches Claude with --claude-first-party-sign-in, the same way the app does when you choose to sign in with claude.ai.
The script's own state lives in ~/.claude-switch/:
state.json profiles and where the workspace is now
profiles/<name>/auth/ an account's saved sign-in
backups/ the last 8 backups
switch.log log of background operations
Building from source
You need the Xcode Command Line Tools (xcode-select --install).
git clone https://github.com/qxlies/claude-switch.git
cd claude-switch
./app/build.sh --zip # → app/build/Claude Switch.app and ClaudeSwitch.zip
CLAUDE_SWITCH_SRC=./claude-switch CLAUDE_SWITCH_APP_ZIP=app/build/ClaudeSwitch.zip ./install.sh
The app is built with plain swiftc (no Xcode project), as a universal binary, ad-hoc signed. It finds Liquid Glass (NSGlassEffectView) at runtime, so it builds with older SDKs and falls back to vibrancy on macOS versions before 26.
claude-switch the switching engine (Python, stdlib only); the app bundles a copy
install.sh installer
app/Sources/ SwiftUI app: menu bar panel, main window, glass components
app/tools/make-icon.swift draws the app icon
app/build.sh builds, bundles, signs and zips the app
Backups and recovery
Before every use, add and sync, the script saves config.json, claude_desktop_config.json, ccd-session-presets.json and the claude-code-sessions and local-agent-mode-sessions folders to ~/.claude-switch/backups/<date>-<action>/.
If something goes wrong, restore manually:
osascript -e 'quit app "Claude"'
B=~/.claude-switch/backups/<backup-folder>
D=~/Library/Application\ Support/Claude
cp "$B"/*.json "$D"/
rsync -a "$B/claude-code-sessions/" "$D/claude-code-sessions/"
rsync -a "$B/local-agent-mode-sessions/" "$D/local-agent-mode-sessions/"
open -a Claude
rsync without --delete only adds files and never removes any. If the chats end up under a different account after restoring, run claude-switch sync.
Troubleshooting
Claude opened on the sign-in screen after switching.
The saved sign-in expired. This usually happens when an account wasn't used for about a month, or after "sign out everywhere" on another device. Just sign in again: the script refreshes the snapshot on the next switch.
Claude opened in Gateway mode.
Fixed in 1.1.0, so update with claude-switch update. If you still end up in Gateway, click "Sign out" and sign in with claude.ai.
Chats disappeared after signing in to another account directly in Claude.
They aren't deleted, they are under the previous account or organization. Run claude-switch sync (or click Move chats in the panel): it gathers them from every saved account, together with their sidebar sections. To avoid this, don't use "Sign out" inside Claude; switch with the script instead.
Usage limits are hours old.
Claude Desktop rarely records them on its own. Turn on Live usage (see Usage limits and Live usage).
"Claude did not quit".
Claude is most likely showing a confirmation dialog (for example, sessions are running). Confirm it, or rerun the command with --force.
command not found: claude-switch.
Open a new terminal window. If that doesn't help, add export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc.
Where to look for details.
The script's log is ~/.claude-switch/switch.log. Claude's logs are in ~/Library/Logs/Claude/main.log.
Security and privacy
- Everything runs locally: the script sends nothing anywhere and talks to no servers (except GitHub, in
update). The only exception in the app is Live usage, which is off until you turn it on: it sends your accounts' existing sign-in tokens toapi.anthropic.comto read the limits, and nowhere else. - Saved sign-ins are stored in
~/.claude-switch/profileswith700permissions (only your macOS user can read them). They are encrypted with Claude's key from your Keychain, so they are useless on another computer.
[!CAUTION]
Don't publish or send anyone your~/.claude-switchfolder: on this Mac it holds working sign-ins to your accounts.
Updating and uninstalling
claude-switch update # latest version from GitHub
claude-switch uninstall # remove the command and the app, keep profiles
claude-switch uninstall --purge # remove everything, including saved sign-ins and backups
Uninstalling doesn't touch your chats: they stay in the folder of whichever account is active.
License
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi