claude-code - 💡(How to fix) Fix [BUG] PTY leak: Claude desktop app accumulates ~490 /dev/ptmx file descriptors

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Code Example

[forkpty: Device not configured]
[Failed to create a new process and open a pseudo-terminal (pseudo-tty).]
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

macOS 15.7.3

Claude Desktop Client

<img width="1170" height="742" alt="Image" src="https://github.com/user-attachments/assets/9274c654-97b8-4d23-8a71-d897bb917d64" />

After running for 4 days, lsof /dev/ptmx showed that the Claude process held 490 PTY FDs, exceeding the kern.tty.ptmx_max=511 limit, causing the system terminal to fail to open (forkpty: Device not configured). More detailed information is available here: https://douwen.me/en/archives/1206/

What Should Happen?

Claude does not encounter any errors even after a long period of time without being restarted.

Error Messages/Logs

[forkpty: Device not configured]
[Failed to create a new process and open a pseudo-terminal (pseudo-tty).]

Steps to Reproduce

This bug won't reproduce within five minutes; it requires time to accumulate. Based on observations on my machine, the typical triggering path is as follows:

First, the Claude desktop client runs continuously for several days without exiting. This is typical for moderately intensive users; many Macs restart more than a week apart.

Second, frequent use of Claude Code during this period, including opening sessions within the Claude application, launching Claude Code commands in an external terminal, running batch tasks in headless mode, etc. Each additional triggering scenario increases the frequency of PTY requests.

Third, other system applications occasionally use PTYs, such as iTerm, the Cursor's built-in terminal, and remote SSH. These will overlap with the Claude leak, accelerating the rate at which the bug reaches its limit.

After meeting the first two conditions, the 511 limit will be reached in approximately 3-5 days. The lsof results for this machine at the time of this report show that Claude holds 490 PTYs, and other processes occupy about 15, for a total of 505. This is only 6 away from the upper limit of 511, so opening a new terminal will almost certainly fail.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

v1.8089.1

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

More detailed information is available here: https://douwen.me/en/archives/1206/

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING