DEV Community

Chai Pin Zheng
Chai Pin Zheng

Posted on

Isolating Codex CLI and Desktop profiles with CODEX_HOME

I built codex-profiles because I kept running into the same boring problem: one Codex setup is fine until you need to separate personal, work, school, or client accounts.

Codex already has the right low-level primitive for this: CODEX_HOME.

The wrapper is intentionally small. Each profile maps to a separate home directory:

default -> ~/.codex
work    -> ~/.codex-work
client  -> ~/.codex-client
Enter fullscreen mode Exit fullscreen mode

Then commands run Codex with that profile-specific home:

codex-profile init work
codex-profile login work
codex-profile cli work
codex-profile app work ~/Dev/project
Enter fullscreen mode Exit fullscreen mode

That means each profile keeps its own auth, config, sessions, plugins, caches, and logs. The important boundary is that the tool only sets CODEX_HOME; it does not read, copy, print, parse, or migrate auth.json tokens.

This is useful when:

  • personal and work Codex accounts should not share local state
  • client projects need separate sessions and config
  • you want parallel Codex Desktop windows on macOS
  • you want a repeatable login/init flow instead of shell aliases

It is a dependency-free Bash CLI, works on macOS/Linux, and installs through npm or Homebrew.

Project page: https://ducksss.github.io/codex-profiles/
Repo: https://github.com/Ducksss/codex-profiles

I would especially like feedback on whether the profile model and safety boundary are clear enough in the docs.

Top comments (0)