[BUG] /terminal-setup does not work from inside tmux

Open 💬 20 comments Opened Aug 18, 2025 by dlee

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [x] Other: claude code
  • Claude CLI version: 1.0.83 (Claude Code)
  • Operating System: macOS 15.6
  • Terminal: iTerm2, tmux

Bug Description

The /terminal-setup slash command is unavailable if run from within tmux.

Steps to Reproduce

  1. Launch tmux in iTerm2
  2. From within a tmux pane, launch claude
  3. Run /terminal-setup from within claude

Expected Behavior

/terminal-setup should run like normal and shift-enter should input a newline.

Actual Behavior

/terminal-setup is not detected as a slash command and shift-enter does not input a newline.

Additional Context

tmux is being run from within iTerm2. The workaround is to launch claude from outside of tmux first and running /terminal-setup there. Subsequent uses of claude from within tmux should then be able to use shift-enter as newline input.

View original on GitHub ↗

20 Comments

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/946
  2. https://github.com/anthropics/claude-code/issues/1300
  3. https://github.com/anthropics/claude-code/issues/5183

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

gpakosz · 10 months ago

On macOS...

Within tmux, the LC_TERMINAL environment variable is set to iTerm2:

$ env | grep '[L]C_TERMINAL'
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.5.14

And the TERM_PROGRAM environment variable is set to tmux:

env | grep '[T]ERM_PROGRAM'
TERM_PROGRAM=tmux
TERM_PROGRAM_VERSION=3.5a

Outside of tmux, the TERM_PROGRAM environment variable is set to iTerm.app:

$ env | grep '[T]ERM_PROGRAM'
TERM_PROGRAM_VERSION=3.5.14
TERM_PROGRAM=iTerm.app

Claude Code should likely inspect both

gpakosz · 10 months ago

On macOS, you can workaround this by doing

alias claude='TERM_PROGRAM=iTerm.app claude'
github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

gpakosz · 7 months ago

ping

haynlyn · 6 months ago

I have a similar issue with Shift+Enter and tmux in Kitty and Ghostty.

/terminal-setup now shows in those terminals with tmux as of v2.1.9 but Shift+Enter does nothing in a tmux session although it does add the newline outside of tmux.

tobalsan · 6 months ago

Confirm same issue with Kitty in tmux (no issue outside tmux).

Update: actually, it's not a Claude Code issue but a terminal/tmux compatibility issue.
A quick search surfaced this post which provides a solution.

For kitty, you can add this to your ~/.config/kitty/kitty.conf:

map shift+enter send_text all \x1b\r

And voilà, shift+Enter enabled in Claude Code.

Muadiv · 5 months ago

Same here, but with ITerm2 , it doesn't work 👎

MarkMolina · 5 months ago

The proposed workaround did not work but this wrapper function did:

claude() { TERM_PROGRAM=iTerm.app command claude "$@"; }

ambethia · 5 months ago
The proposed workaround did not work but this wrapper function did: claude() { TERM_PROGRAM=iTerm.app command claude "$@"; }

THank you!!!!

For anyone else who uses more than just iTerm and only wants this for iTerm+tmux and leave other apps alone, I put this in my tmux.conf

set-option -ga update-environment " TERM_PROGRAM"

And in my .zshrc:

if [[ -n "$TMUX" ]] && \
    [[ "$(tmux show-environment TERM_PROGRAM 2>/dev/null)" == "TERM_PROGRAM=iTerm.app" ]]; then
  claude() { TERM_PROGRAM=iTerm.app command claude "$@"; }
fi
Anoromi · 5 months ago

In my case with ghostty + tmux I added this line to my tmux config

bind-key -T root S-Enter send-keys Escape "[13;2u"

Might have side effects I didn't expect but at least the problem was solved.

limijd · 5 months ago

tmux3.6a , iterm2, Shift-Enter just submitted the prompt instead of newline in Claude CLI

Tried all ways Claude suggested but no luck.

nahime0 · 5 months ago
In my case with ghostty + tmux I added this line to my tmux config `` bind-key -T root S-Enter send-keys Escape "[13;2u" `` Might have side effects I didn't expect but at least the problem was solved.

Greate, this solved the problem for me with Ghostty and tmux. Thanks

penelopeysm · 4 months ago

None of the above worked for me (iTerm2 3.6.6, tmux 3.6a) but this post on Reddit worked. Quoting here for convenience:

1. Open iTerm2 → Settings (⌘ + ,) 2. Go to Profiles → Keys 3. In the Key Mappings section, click the “+” button 4. Record the keyboard shortcut: - Click the Keyboard Shortcut field - Press Shift + Enter - It should display as ⇧Return↩ 5. Configure the action: - Set Action to Send Hex Code - In the text field, enter: 0x1b 0x0d 6. Click OK 7. Restart iTerm2

Edit: Claude suggested a similar fix if you want Option-Left and Option-Right to skip over words (like readline M-b and M-f): map them to 0x1b 0x62 and 0x1b 0x66 respectively. Can confirm it works on my setup.

Zeppelinpp · 4 months ago
In my case with ghostty + tmux I added this line to my tmux config `` bind-key -T root S-Enter send-keys Escape "[13;2u" `` Might have side effects I didn't expect but at least the problem was solved.

I just use Ctrl + j in tmux, it behave the same way as shift + enter, or you can set the key-bind for tmux in .tmux.conf:
bind-key -T root S-Enter send-keys C-j

robert-wallis · 3 months ago

Adding this to my tmux config not only fixed Shift+Enter, but also fixed Cmd+V paste:

set -g extended-keys always
set -as terminal-features 'xterm*:extkeys'
BitCalSaul · 3 months ago

for ghostty+tmux on mac connecting to claude session in remote server through ssh, cmd+enter works.

u35253 · 3 months ago
Adding this to my tmux config not only fixed Shift+Enter, but also fixed Cmd+V paste: `` set -g extended-keys always set -as terminal-features 'xterm*:extkeys' ``

Thanks, this worked in tmux in iTerm 2 on macOS.

mcint · 2 months ago

https://code.claude.com/docs/en/terminal-config#configure-tmux

# ~/.tmux.conf or ~/.config/tmux/tmux.conf
set -g allow-passthrough on
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'

Will allow S-Enter (and Cmd-V -- paste block, different than raw input) behavior in tmux.

ronaldsuwandi · 11 hours ago

@mcint tried that and S-Enter still doesn't work on Kitty+tmux