Last Updated: November 06, 2018
·
30.06K
· 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.

5 Responses
Add your response

what is first and second param ? 512 and 1024 ?

over 1 year ago ·

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 ·

what's the max number of maxfiles?

over 1 year ago ·

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 ·

Has anyone tried this with Mojave (10.14.x) yet?

over 1 year ago ·