Skip to content

macOS: LC_ALL forced to C.UTF-8 in codex CLI shell commands (unified exec) #9354

Open

Description

@tzanko-matev

What version of Codex is running?

codex-cli 0.84.0

What subscription do you have?

Pro

Which model were you using?

5.2-codex

What platform is your computer?

Darwin 23.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

iTerm2

What issue are you seeing?

When running shell commands via codex-cli on macOS, LC_ALL is forcibly set to C.UTF-8 even if the user’s locale is different. Note that C.UTF-8 is not usually available on MacOS. This happens without user opt-in and affects command behavior that depends on locale. In particular it can lead to various commands printing warning messages. It appears to come from unified exec environment injection.

Steps to Reproduce

  1. On macOS, run Codex CLI (TUI).
  2. Enter prompt:
    Run "env | egrep '^(LANG|LC_)'" and report the result
  3. Observe output contains LC_ALL=C.UTF-8.

Expected Result:

LC_ALL should reflect the user’s environment (or be unset), unless explicitly configured by the user or the command.

Actual Result:

LC_ALL is always set to C.UTF-8.

Suspected Cause

Unified exec injects a fixed locale, including LC_ALL=C.UTF-8, for all unified exec processes.

  • codex-rs/core/src/unified_exec/process_manager.rs:50 (UNIFIED_EXEC_ENV)
  • codex-rs/core/src/unified_exec/process_manager.rs:486 (applies env)

Workarounds

  • Disable unified exec for the session: codex --disable unified_exec …
  • Run locally with ! in the TUI (bypasses unified exec)
  • Override in the command: LC_ALL= LANG= LC_CTYPE= env | egrep '^(LANG|LC_)'

What steps can reproduce the bug?

  1. On macOS, run Codex CLI (TUI).
  2. Enter prompt:
    Run "env | egrep '^(LANG|LC_)'" and report the result
  3. Observe output contains LC_ALL=C.UTF-8.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    bug
    on Jan 16, 2026
  2. added
    CLI
    on Jan 16, 2026
  3. added
    agent
    and removed
    CLI
    on Jan 18, 2026
  4. added a commit that references this issue on Jan 18, 2026
    70975d1
  5. pusherofbrooms commented on Feb 18, 2026

    @pusherofbrooms

    I'm running into this. I use nixpkgs provided bash. My locale output for a login shell is

    $ locale
    LANG="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_CTYPE="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_ALL=
    

    This looks correct to me. Codex tells me that its related variables are set to:

    LANG=en_US.UTF-8
    LC_ALL=C.UTF-8
    

    So this seems to be set by codex.

    My concern is that pollutes the context and adds unnecessary tokens.

  6. sstklen commented on Feb 24, 2026

    @sstklen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions