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
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/63715/5fb7eccdf7b06d87937ce53be9474e1f.jpeg)
what is first and second param ? 512 and 1024 ?
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/29955/0b50c2089eed118232ae1ab41e39faf0.jpeg)
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.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/108204/bf196f31f3fec36fa88df8a12334c6c3.jpeg)
what's the max number of maxfiles?
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/29955/0b50c2089eed118232ae1ab41e39faf0.jpeg)
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?