I'm running into problems on my OS X machine that I can trace back to the number of open files allowed per process. If I look at the maxfiles
option using launchctl
's limit
command (on my OS X El Cap machine)
$ launchctl limit
cpu unlimited unlimited
filesize unlimited unlimited
data unlimited unlimited
stack 8388608 67104768
core 0 unlimited
rss unlimited unlimited
memlock unlimited unlimited
maxproc 709 1064
maxfiles 256 unlimited
There appears to be a soft limit of 256, and a hard limit of "unlimited". I'd like to change the soft limit to be something like 2048
, and leave the hard limit untouched. When I look at limit
's arguments
$ launchctl help limit
Usage: launchctl limit [<limit-name> [<both-limits> | <soft-limit> <hard-limit>]
It appears I can either set both limits to the same thing, or set a value for soft and hard. However, if I attempt to set a hard limit of unlimited.
$ sudo launchctl limit maxfiles 2048 unlimited
I end up with the curious value of 10240
$ launchctl limit
cpu unlimited unlimited
filesize unlimited unlimited
data unlimited unlimited
stack 8388608 67104768
core 0 unlimited
rss unlimited unlimited
memlock unlimited unlimited
maxproc 709 1064
maxfiles 2048 10240
What's going on here? Is it possible to set a value of unlimited? If not, is that a limitation of the launchctl limit
command, or something on the system level? If the later, what are all those initial value of unlimited
reporting? Or is this Apple being Apple?
For bonus points -- does anyone know why this limit is set so low in the first place?