How to change default ulimit values in Mac OS X 10.6?

Mac OS X limits number of processes to 266 and open files to 256. Sometimes this is problem; 256 open files and 266 processes aren't that much.

How it's possible to change default ulimit values in Mac OS X 10.6.7?

(Hopefully there's no difference between 10.6.7 and other Snow Leopard releases.)

Related question in serverfault. Unfortunately, answer is for Mac OS X 10.5, and it's not working in 10.6.


Solution 1:

launchctl has control over that now.

You can do a

launchctl limit maxfiles 2048 2048 

to set the soft and hard limits for maximum files open. For more information see the 'limit' section of:

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/launchctl.1.html

Solution 2:

There's an answer on StackOverflow for this one. Apparently ulimit does it now.

Solution 3:

As @snowe2010 said in a comment, the correct command for Sierra+ would be:

launchctl limit maxfiles 2048 unlimited