http://blog.ghostinthemachines.com/2010/01/19/mac-os-x-fork-resource-temporarily-unavailable/ talks about this issue in great detail.
When you do sudo launchctl limit maxproc
, you're viewing or changing the system-wide launchd limits.
When you do launchctl limit maxproc
, you're viewing or changing the launchd limits for your user.
One thing to keep in mind is this:
The root user can increase the hard limits of the system-wide launchd,
without a reboot. However, you cannot change a user’s launchd hard
limits without a reboot (even if trying to do so as the root user).
Basically, the hard limit (the right hand column) that is displayed when you initially do launchctl limit maxproc
will be the limit that you can set using ulimit -u
without rebooting. Logging out and back in will not work. Even if you change whats displayed by launchctl limit maxproc
, the initial hard limit remains. See this answer for a bit more info on the relationship between ulimit
and launchctl limit
.
To raise that limit, you have to
edit/create /etc/sysctl.conf
to raise the maximum processes supported by the kernel
kern.maxproc=2500
kern.maxprocperuid=2500
edit/create /etc/launchd.conf
to raise the hard limits of the system-wide launchd at boot time
limit maxproc 2500 2500
reboot
Also note that 2500 seems to be the maximum limit that kern.maxproc
can be set to. I'll ask a question about this as soon as I reboot and have enough free processes to open another Chrome tab.
launchd.conf
method no longer works in Mavericks and other newer distributions. – kenorb Jun 30 '16 at 10:14