Claude desktop leaks PTY file descriptors, exhausting system PTY limit

Resolved 💬 3 comments Opened May 12, 2026 by optimiz-r Closed May 15, 2026

Summary

The Claude desktop app leaks PTY (pseudo-terminal) master file descriptors over time. Each bash tool call opens /dev/ptmx but the handles are never closed when the session ends. This causes the system-wide PTY pool to be exhausted, breaking other terminal applications.

Impact

  • Ghostty fails to open new terminal windows with: _"Your system cannot allocate any more pty devices."_
  • Zellij fails to start with: _"could not enable raw mode: Os { code: 6, kind: Uncategorized, message: "Device not configured" }"_
  • Any app that requires PTY allocation is affected.

Reproduction

Use Claude desktop with the bash tool across multiple sessions/conversations over time. The PTY count grows monotonically.

Evidence

$ lsof 2>/dev/null | grep "ptmx" | awk '{print $1, $2}' | sort | uniq -c | sort -rn | head -5
 513 Claude 60807     ← nearly all PTYs consumed by Claude desktop
   3 wezterm-g 99670
   3 Safari 14780
   ...
$ sysctl kern.tty.ptmx_max
kern.tty.ptmx_max: 511

513 open PTY masters in a single Claude process against a system limit of 511.

Workaround

Quit and relaunch the Claude desktop app to release all leaked handles.

Environment

  • macOS Darwin 25.4.0 (Apple Silicon, J614s)
  • Claude desktop version: 2.1.136
  • Ghostty version: reported in error message

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗