DEV Community

Chai Pin Zheng
Chai Pin Zheng

Posted on

Stop copying Codex auth files: use CODEX_HOME profiles instead

If you use Codex with more than one account, repo context, or local setup, the usual workaround gets old quickly: copy one auth.json somewhere safe, swap it back later, and hope you did not overwrite the wrong state.

I wanted something boring and explicit, so I made codex-profiles: a small open-source helper that launches Codex CLI or Codex Desktop with a named CODEX_HOME.

GitHub: https://github.com/Ducksss/codex-profiles

The problem

Codex keeps useful local state under CODEX_HOME: auth, config, sessions, plugins, logs, and other local files. That is convenient for one identity, but awkward when you want clean separation between:

  • work and personal accounts
  • experimental and stable config
  • different plugin sets
  • repo-specific sessions
  • short-lived test logins

You can script around it manually, but copying auth files is a brittle workflow.

The workflow

Install with Homebrew:

brew install Ducksss/tap/codex-profile
Enter fullscreen mode Exit fullscreen mode

Create or log into a profile:

codex-profile login work
Enter fullscreen mode Exit fullscreen mode

Run Codex CLI using that profile:

codex-profile cli work exec "review this repo"
Enter fullscreen mode Exit fullscreen mode

Open Codex Desktop with a separate local profile:

codex-profile app personal
Enter fullscreen mode Exit fullscreen mode

Each profile maps to its own CODEX_HOME, so the local Codex state stays isolated without moving files around by hand.

Why this shape

The tool is intentionally small. It does not try to wrap the entire Codex workflow or invent a new config model. It just makes the boundary explicit:

CODEX_HOME=<profile-directory> codex ...
Enter fullscreen mode Exit fullscreen mode

That means the underlying Codex behavior stays familiar, while profile switching becomes a repeatable command.

What it is useful for

  • keeping work and personal Codex auth separate
  • testing new Codex config without touching your main setup
  • keeping separate plugin/session state per context
  • launching Desktop or CLI against the same named profile
  • avoiding accidental auth.json swaps

Try it

brew install Ducksss/tap/codex-profile
codex-profile login work
codex-profile cli work exec "summarize this repo"
Enter fullscreen mode Exit fullscreen mode

The project is open source and dependency-light. Feedback from other Codex users would be useful, especially around naming, install friction, and profile workflows I have missed.

Repo: https://github.com/Ducksss/codex-profiles

Top comments (0)