macOS: LC_ALL forced to C.UTF-8 in codex CLI shell commands (unified exec)
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
- On macOS, run Codex CLI (TUI).
- Enter prompt:
Run "env | egrep '^(LANG|LC_)'" and report the result
- 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?
- On macOS, run Codex CLI (TUI).
- Enter prompt:
Run "env | egrep '^(LANG|LC_)'" and report the result
- Observe output contains LC_ALL=C.UTF-8.
What is the expected behavior?
_No response_
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗