Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

There is not any ulimit configuration in system startup files/ shell startup scripts.

ulimit -a shows:

-u: processes                       1064
-n: file descriptors                256

launchctl limit shows:

maxproc     2048           2048           
maxfiles    2048           2048

I vaguely remember that launchctl's limits should match with a shell's ulimit output, I might be wrong.

Is there any relationship between the lauchctl's limits and ulimit?

share|improve this question
    
Do you not get satisfactory answers from the commands' man page? –  Andrew U. Jan 10 at 8:11
    
@AndrewU. launchctl manual page does not mention limit, ulimit manual page does not mention launchctl or launchd. –  Howard Jan 10 at 8:47

1 Answer 1

up vote 1 down vote accepted
+50

In the shell, ulimit provides "control over the resources available to the shell and to processes started by it" (see man bash). Therefore, it applies only to the shell and its children. The limits for launchd are related to it and the processes that it manages. The two are separate.

Individual programs can set their own resource limits by calling the Standard C Library routines ulimit() or getrlimit() and setrlimit(). Certain resource limits cannot be elevated unless the process is running as the super-user.

As a practical example, I debug large software projects and the shell's default limit for the number of open files isn't big enough. In my .bashrc file, I have the following:

# Increase the upper limit on the number of open files:
ulimit -n 1024

Now my debugger won't complain that it can't open all the files it needs. Obviously, this should have no impact on launchd.

share|improve this answer
1  
To elaborate on that: default ulimit settings are derived from launchctl limit; although user may change ulimit numbers, however they may not exceed launchctl limit hard limits. –  Howard Jan 15 at 18:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.