Persist ulimit settings in Mac OS X
Apple moved to launchd rather than sysctl for persisting things like maxfiles and other things you might find with ulimit. See the output of:
launchctl limit
To set a new limit:
launchctl limit maxfiles 1024 2048
To persist these things across reboots, create:
/etc/launchd.conf
and add just the arguments to the launchctl program:
limit maxproc 512 1024
limit maxfiles 1024 2048
Now new shells created after reboots will maintain the new values.
Written by Anders Brownworth
Related protips
5 Responses
what is first and second param ? 512 and 1024 ?
The two numbers represent soft and hard limits. When the soft limit is reached, the process may receive a signal but will be allowed to continue. When it reaches the hard limit, it will be blocked.
what's the max number of maxfiles?
It isn't specifically limited but setting it unreasonably high might let a process cause the kernel to eat up all available memory. It is a per-process limit and is there to safeguard a runaway process opening file handles from starving the entire system of RAM.
Has anyone tried this with Mojave (10.14.x) yet?