This problem has been bugging me for a couple years. The default limit of 256 files per process is quite small and i've bumped up against the limit in several programs, most frequently with firefox w/many tabs, which i think has some bug where files fail to get closed. The problem gets worse if you run a tab firefox extension like tabmixplus. The result is an ugly mess of failures, where css/images/html randomly fail to load, dialog boxes are full of fail, and you have no choice but to restart firefox.
I know how to work around it; i can change the limit on the command line and launch firefox from there, or i can modify the shell script that executes firefox, or i can make my own wrapper script, but none of those is particularly elegant or even close to the macintosh way.
kern.maxfiles and kern.maxfilesperproc are not the way to go; those are already set to 12288 and 10240. I've even tried grepping for 256 in /etc with no luck.
As a last resort i suppose i can try downloading the darwin source and learning how the OS X boot process works, but really, all i want to change is a little shell variable.
(maybe i miss freebsd?)