iTerm2 Command shortcuts captured when keyboard enhancement is enabled

Open 💬 1 comment Opened Aug 27, 2026 by hawaiigal
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.150.0

What subscription do you have?

Enterprise

Which model were you using?

gpt-5.6

What platform is your computer?

macOS: 26.6 (25G72)

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

iTerm2: 3.6.11

Codex doctor report

What issue are you seeing?

While the Codex TUI is active in iTerm2, macOS/iTerm shortcuts such as
Cmd+V and Cmd+N stop working. Edit → Paste still works.

Apple Terminal is unaffected.

Workaround:
CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1 codex

Expected: Codex should not capture iTerm/macOS Command shortcuts.

What steps can reproduce the bug?

Opening codex in iterm2 and attempting to paste text

What is the expected behavior?

The text pastes into the prompt

Additional information

_No response_

View original on GitHub ↗

1 Comment

etraut-openai contributor · 3 hours ago

This looks consistent with an iTerm2 keyboard setting. Codex enables the Kitty keyboard protocol, which can activate Command-key remappings that don’t apply at the shell prompt.

Could you check Settings → Profiles → your active profile → Keys → General, specifically the left and right Command-key settings? If either is mapped to Hyper, Meta, or Super, restore its default Command behavior and retry Codex without CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT.

If both already use their defaults, please share a screenshot of those settings and whether this reproduces with a fresh default profile. That will help distinguish a configuration issue from a terminal compatibility bug.

Could you also use /keymap debug to check what iTerm sends to Codex?

  1. Start Codex without CODEX_TUI_DISABLE_KEYBOARD_ENHANCEMENT=1.
  2. Enter /keymap debug to open the Keypress Inspector.
  3. Press a plain letter to confirm the inspector updates, then try Cmd+V and Cmd+N separately. Try both left and right Command keys.
  4. For each shortcut, share the Detected, Config key, Raw event, and Assigned actions fields—or say if the display doesn’t change. Capture each result before pressing another key, since the inspector only shows the latest event.
  5. Press Ctrl+C to close the inspector; Esc is inspected rather than closing it.
  6. Repeat with keyboard enhancement disabled and tell us what differs.

If the raw event shows SUPER, HYPER, or META for a Command shortcut, that would support the iTerm remapping explanation.

Note: The inspector displays key events, not pasted text. No change after Cmd+V isn’t itself a failure; close the inspector and test actual pasting at the normal prompt.