After upgrading to Mac OS 10.6.5 this morning while working on Quote Manager, I went to restart apache via the “sudo apachectl restart” command and was presented with an obscure error message:
/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
Since apachectl was working fine 5 minutes before I updated to Mac OS 10.6.5, I figured the two were related. After a quick dig into what the update entailed, I found that Apple updated to Apache 2.2.15, which patched a number of vulnerabilities (http://support.apple.com/kb/HT4435). It turned out that one of those changes broke the apachectl script. Referring to line 82 of apachectl, the shell script was referring to the ULIMIT_MAX_FILES variable, which was set to:
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
Changing the line as follows fixed the problem: