我是开发者,日常工作会同时打开大量终端(tmux、多项目、自动化脚本、node‑pty 等)。在这种现代开发场景下,511 的 PTY 上限明显过低,而且这个默认值对顶配机器(128GB RAM)和低配机器是一样的,没有随硬件规格调整,这不合理。
我尝试过使用 tmux control mode 来减少 PTY 占用,但它会导致终端输出对齐错乱,影响可用性,所以必须继续使用 PTY 模式。这意味着只要终端数量稍多,就很容易触及 511 上限,导致系统层面无法创建新终端,影响全局稳定性。
总结:
-
511 作为默认值在过去或许合理,但对现代开发者明显不足;
-
顶配机器和低配机器同一上限不合理;
-
control mode 有输出对齐问题,无法作为现实替代方案。
谢谢!
Apple 支持社区工作人员
Sadly, I can’t read Chinese, so I’m answering based on a machine translation.
My understanding is that:
- The 511 limit is a default.
- The hard limit is 999.
- You can control this via
sysctlwith thekern.tty.ptmx_maxselector, for example:
% sudo sysctl kern.tty.ptmx_max=800
kern.tty.ptmx_max: 511 -> 800
Please try that out and let me know how you get along.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"