Avatar
Mostly just a place where I dump interesting things I've learned that I'm pretty sure I'll forget.. It's my own personal knowledge base.

managing multiple claude code profiles with claude-profile

About

I’ve been using Claude Code pretty heavily for both work and personal stuff, and I ran into something that kept bugging me.. there’s no way to keep your sessions separate. Auth tokens, settings, MCP configs, plugins — it all lives in one ~/.claude directory. So I built claude-profile to deal with it.

The Problem

Claude Code stores everything in $HOME/.claude. One directory, shared across every project, every account, every context. If you’re logged into your work account.. your personal projects use those same credentials and configs. There’s no concept of profiles or workspaces.

In practice this means:

  • You can only be logged into one account at a time
  • MCP servers you set up for work show up in personal projects (and vice versa)
  • You can’t run work and personal Claude instances side-by-side

I tried juggling symlinks for a bit and that got old fast. I wanted something that just worked.

How claude-profile Works

It turns out Claude Code supports a CLAUDE_CONFIG_DIR environment variable that redirects where it looks for config. Under the hood it hashes that path with SHA-256 and generates a unique macOS Keychain entry for credential storage.. so each config dir gets fully isolated auth. That’s the key insight — you don’t need to hack anything, you just need to manage that environment variable.

claude-profile is a small Go binary that does exactly that. Each profile gets its own directory at ~/.claude-profiles/<name>/config/, and the wrapper sets CLAUDE_CONFIG_DIR before launching Claude.

# Create a work profile
$ claude-profile create work

# Create a personal profile
$ claude-profile create personal

# Launch Claude with your work profile
$ claude-profile -P work

# Or set it via environment variable
$ CLAUDE_PROFILE=personal claude-profile

Everything passes through transparently — all your normal Claude Code arguments and flags work exactly the same.

Setting Up a Profile

The create command walks you through an interactive wizard:

$ claude-profile create work
Profile name: work
Config directory: /Users/matt/.claude-profiles/work/config
Pick a statusline color (for visual identification): blue
Profile 'work' created successfully!

Each profile gets its own statusline color so you can tell at a glance which account you’re in. I found this surprisingly useful — it’s one of those things where you don’t realize how much you needed it until you have it.

Installation

Prebuilt binaries are available for Linux, macOS, and Windows (both amd64 and arm64):

# Quick install (auto-detects OS/arch, verifies checksums)
curl -fsSL https://raw.githubusercontent.com/diranged/claude-profile/main/install.sh | bash

# Or via Go
go install github.com/diranged/claude-profile@latest

Final Thoughts

Honestly this feels like something that should be a built-in feature. But until it is, claude-profile handles it with zero modifications to Claude Code itself — just a thin wrapper around an environment variable that was already there.

If you’re juggling multiple accounts, check it out at github.com/diranged/claude-profile.

all tags