Need more pseudo terminals I'm running tmux and creating many sessions to various servers. After opening 128, I can no longer open new ones, or open new tabs in Terminal. The error messages is:

forkpty: Device not configured
Could not create a new process and open a pseudo-tty.


Is there any way I can increase the number of ptys?
(Tested on OS X 10.8.2; other releases may be slightly different.)

You can change the system’s limit on ptys with the sysctl command.

sudo sysctl -w kern.tty.ptmx_max=255


This should immediately let you open more ptys.

To set this automatically after each reboot, put the following line in the /etc/sysctl.conf file:

kern.tty.ptmx_max=255


(Note: I did not try this, but, from a look at the source code, it looks like launchd does process this file.)

This file may not exist; if you have to create it, you should probably be sure it has restricted ownership and permissions:

sudo chown root:wheel /etc/sysctl.conf
sudo chmod 644 /etc/sysctl.conf




Eventually, you may run into some other per-process or per-user resource limits (e.g. total number of processes per user, and total number of open file descriptors per process).