Skip to content

pegasusheavy/claude-code-profiles

Repository files navigation

claude-profile

Manage multiple Claude Code configuration profiles. Switch between work and personal accounts, different MCP server setups, or separate settings without logging in and out.

Each profile is a complete, isolated Claude Code configuration directory (settings, credentials, MCP servers, CLAUDE.md, history -- everything). Once configured, claude automatically uses your active profile -- no special launch command needed.

Install

Linux / macOS / WSL:

curl -fsSL https://raw.githubusercontent.com/pegasusheavy/claude-code-profiles/main/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/pegasusheavy/claude-code-profiles/main/install.ps1 | iex

The installer downloads the appropriate scripts and configures your shell. Restart your shell (or open a new terminal) after installing.

Quick Start

# Create profiles
claude-profile create work
claude-profile create personal

# Set a default
claude-profile default work

# Just use claude — it automatically uses your default profile
claude
claude --resume
claude -p "explain this code"

Commands

Command Description
claude-profile Show current profile status
claude-profile use <name> Switch to a profile for this session
claude-profile create <name> Create a new profile
claude-profile list List all profiles
claude-profile default [name] Get or set the default profile
claude-profile delete <name> Delete a profile (with confirmation)
claude-profile which [name] Show the config directory path
claude-profile help Show help

How It Works

Claude Code supports a CLAUDE_CONFIG_DIR environment variable that redirects where it stores configuration and data. claude-profile provides a claude() shell function that wraps the real claude binary:

  1. Before each invocation, the wrapper checks if a default profile exists and auto-sets CLAUDE_CONFIG_DIR.
  2. If CLAUDE_CONFIG_DIR is already set (e.g., via claude-profile use), it is used as-is.
  3. The real claude binary is then called with all your arguments.

This means you never need to think about profiles during normal use -- just run claude as you always have.

Session Override

To temporarily use a different profile in the current shell session:

# Temporarily use a different profile
claude-profile use personal
claude                          # uses "personal" for this shell session

The override lasts until you close the shell or run claude-profile use again.

Profile Storage

Profiles are stored in platform-appropriate locations:

Platform Location
Linux $XDG_DATA_HOME/claude-profiles/ (default: ~/.local/share/claude-profiles/)
macOS $XDG_DATA_HOME/claude-profiles/ (default: ~/.local/share/claude-profiles/)
Windows %LOCALAPPDATA%\claude-profiles\

Each profile directory is a complete Claude Code config directory. After creating a profile and launching Claude with it, Claude will populate it with settings.json, .credentials.json, and everything else it needs.

Profile Names

Profile names can contain letters, digits, hyphens, and underscores. Examples: work, personal, client-acme, side_project.

Platform Support

Script Platform Shell
claude-profile.sh Linux, macOS, WSL bash, zsh (sourced)
claude-profile-init.ps1 Windows, Linux, macOS PowerShell 5.1+ / pwsh 6+ (dot-sourced)
claude-profile.cmd Windows cmd.exe (use with call prefix)

Manual Install

If you prefer not to use the install scripts:

Linux / macOS:

# Download
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/claude-profile"
curl -fsSL https://raw.githubusercontent.com/pegasusheavy/claude-code-profiles/main/claude-profile.sh \
  -o "${XDG_DATA_HOME:-$HOME/.local/share}/claude-profile/claude-profile.sh"

# Add to shell profile (.bashrc or .zshrc)
echo '. "${XDG_DATA_HOME:-$HOME/.local/share}/claude-profile/claude-profile.sh"' >> ~/.bashrc

Windows (PowerShell):

$dir = "$env:LOCALAPPDATA\claude-profile"
New-Item -ItemType Directory -Force -Path $dir | Out-Null
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/pegasusheavy/claude-code-profiles/main/claude-profile-init.ps1" -OutFile "$dir\claude-profile-init.ps1"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/pegasusheavy/claude-code-profiles/main/claude-profile.cmd" -OutFile "$dir\claude-profile.cmd"
# Add to PowerShell profile
Add-Content -Path $PROFILE -Value ". '$dir\claude-profile-init.ps1'"
# Add to PATH for cmd.exe
$path = [Environment]::GetEnvironmentVariable('Path', 'User')
if ($path -notlike "*$dir*") { [Environment]::SetEnvironmentVariable('Path', "$path;$dir", 'User') }

License

MIT

About

Manage multiple Claude Code configuration profiles. Switch between work, personal, and other accounts without logging in and out.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages