Some limits cannot be changed by ulimit
, because they only apply to the current shell, therefore launchctl
command should be used to change the limits globally, e.g.
sudo launchctl limit maxfiles 100000 unlimited
Please note that applying these limits in /etc/launchd.conf
(as suggested in other answers) is no longer supported in the recent macOS releases. Although can still use launchd.plist
(see: man launchd.plist
) such as per-user or system-wide plist
configuration files as suggested here, there, and over there.
To make these limits persistent, you can use /etc/sysctl.conf
file and add for example:
kern.maxprocperuid=1000
kern.maxproc=2000
kern.maxfilesperproc=20000
kern.maxfiles=50000
For changes to take the effect, it requires reboot.
To see the current limits, run: launchctl limit
or sysctl -a | grep ^kern.max
.
See also: How to persist ulimit settings in macOS?
echo limit maxfiles 10000 10000|sudo tee -a /etc/launchd.conf
and restarting works for me in Mavericks.