The setup addresses the lack of an easy way to switch Claude Code accounts on one Mac. It keeps each Claude.ai account signed in by assigning it a separate configuration directory and launching the CLI through a named shell function. For example, a `claude-b` function sets `CLAUDE_CONFIG_DIR` to `~/.claude-b` before running Claude, while the usual `claude` command continues using the default configuration. After logging in through the new command, users should check `auth status` to confirm the correct email and configuration directory; a separate browser or incognito window may help prevent the login flow from selecting an already active account. The same pattern can add a third account.
The separate directories preserve account-specific settings, session history, and credentials, including macOS Keychain entries. A practical arrangement is to leave the Desktop app signed into one account and use the other through the CLI, even from the Desktop app’s terminal. The author stresses that distinct configurations do not isolate access to files: both sessions run as the same macOS user and can modify the same repositories, so work needs clear coordination. Shared rules, skills, or agents can be linked selectively, but symlinks point to the same files, so edits affect both accounts. The method is tested on macOS, applies to claude.ai logins rather than keyless Console authentication, and requires care to verify the active account before making changes.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.