lfjoaq
Last Updated: February 25, 2016
·
21.97K
· andersbrownwort

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.

4 Responses
Add your response

12916

what is first and second param ? 512 and 1024 ?

over 1 year ago ·
12917

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.

over 1 year ago ·
14679

what's the max number of maxfiles?

over 1 year ago ·
14681

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.

over 1 year ago ·