15

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?

3
  • Do you not get satisfactory answers from the commands' man page?
    – Andrew U.
    Jan 10, 2014 at 8:11
  • @AndrewU. launchctl manual page does not mention limit, ulimit manual page does not mention launchctl or launchd.
    – Howard
    Jan 10, 2014 at 8:47
  • Related: Which command controls the open file limits?
    – kenorb
    Jan 11, 2018 at 23:57

1 Answer 1

13
+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.

2
  • 2
    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, 2014 at 18:07
  • this will be reset on reboot Apr 17, 2015 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .