Ctrl-D unexpectedly terminates session instead of deleting characters in macOS

Status Closed — not planned
Maintainer reply None cached
Activity 11 comments · opened May 10, 2025 · closed Mar 1, 2026

# Ctrl-D unexpectedly terminates session instead of deleting characters in macOS

## Description
When using Claude Code CLI on macOS, pressing Ctrl-D unexpectedly terminates the entire session instead of deleting characters forward as it normally would in standard macOS terminals.

## Expected Behavior
Ctrl-D should delete the character at the cursor position (forward delete), matching standard macOS terminal behavior.

## Current Behavior
Pressing Ctrl-D immediately terminates the Claude Code session, causing loss of context and requiring restart.

## Environment Information

  • OS: macOS 15.4.1 (Sequoia)
  • Terminal: xterm-256color (Node.js based terminal emulator)
  • Claude Code version: 0.2.107 (Claude Code)
  • Shell: zsh

## Additional Information
This behavior is disruptive to the normal workflow as many macOS users rely on Ctrl-D for forward deletion. The termination happens without warning or confirmation, potentially causing loss
of work.

## Steps to Reproduce

  1. Start Claude Code CLI with claude command
  2. Begin typing a prompt
  3. Position cursor within the text
  4. Press Ctrl-D
  5. Observe that the session terminates instead of deleting a character

View original on GitHub ↗

11 Comments

mceachen · 12 months ago

This seems to be a regression from the fix applied in #960. It also impacts platform:linux

github-actions[bot] · 8 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.

whw · 8 months ago

I have just encountered this several times today.

Claude Code v2.0.65
MacOS 14.5
Iterm2

cce · 8 months ago

Me too

duckSquirrelPilot · 8 months ago

Can confirm there is a regression here recently.

takeaki-m · 8 months ago

I have encountered this

ClaudeCode: Version: 2.0.76
MacOS: 26.2
Terminal: iTerm2 + tmux

takeaki-m · 8 months ago

FYI: workaround only for nvim plugin example

Use: claudecode nvim plugin https://github.com/coder/claudecode.nvim

Settings:

I disabled Ctrl-D while focusing on claude code buffer.

Here is the setting example.

    {
      "coder/claudecode.nvim",
      requires = { "folke/snacks.nvim" },
      config = function()
        require("claudecode").setup({
          ---@diagnostic disable-next-line: missing-fields
          terminal = {
            snacks_win_opts = {
              keys = {
                disable_ctrl_d = {
                  "<C-d>",
                  function() end,  -- do nothing
                  mode = "t",
                  desc = "Disable Ctrl-D (prevent accidental close)",
                },
              },
            },
          },
        })
      end,
    },
1MikeMakuch · 7 months ago

This happens to me all day long. This happens on linux too. But the description is slightly incorrect in that the 1st Ctrl-D does delete 1 char, it's the 2nd Ctrl-D that terminates claude. It shouldn't terminate claude until/unless the input buffer is empty - same as in bash shell.

takeaki-m · 7 months ago

In my environment(Claude Code v2.1.22), this issue has been fixed. Please check the behavior:

  • with characters: Ctrl + D deletes characters.
  • with no input: type Ctrl + D shows message "Press Ctrl-D again to exit". Pressing again exits claude code.
github-actions[bot] · 6 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.