1

How do I increase my max process hard limit. Currently, I can't go more than 2500. I'm on Mojave 10.14.6.

Currently what I do is:

sudo vim /Library/LaunchDaemons/limit.maxproc.plist // and then increase the limit

sudo launchctl unload -w /Library/LaunchDaemons/limit.maxproc.plist 
sudo launchctl load -w /Library/LaunchDaemons/limit.maxproc.plist
launchctl limit

I can only increase it to 2500. I want it to be much higher than that.

  • Can I ask what you need a higher limit for? – benwiggy Sep 1 at 11:07
  • @benwiggy. Sure, it's to run a wonderful experiment called Bashlog. github.com/thomasrebele/bashlog/issues/3. – RAbraham Sep 1 at 13:22
  • 1
    @RAbraham - from comments on github there seems some confusion between maxproc (max number of concurrent processes) and pid_max (where process id number wraps). maxproc is 2500 while pid_max is 99999 on macOS. On linux pid_max is 32768 for 32 bit systems or up to 4194304 for 64 bit. Looks like (as you suggested) perhaps something isn't closing properly as you shouldn't need that many active processes. – lx07 Sep 1 at 15:45
  • @lx07. I'm extremely grateful that you took the time out to look at the Bashlog issue and provide such a valuable comment. I will relay that to the author. If you ever are ok with connecting on LinkedIn or something, let me know. I'm at linkedin.com/in/rajivabraham – RAbraham Sep 1 at 18:10
3

Looks like kernel is hard coded to 2500 in param.c

#if CONFIG_EMBEDDED
#define NPROC 1000          /* Account for TOTAL_CORPSES_ALLOWED by making this slightly lower than we can. */
#define NPROC_PER_UID 950
#else
#define NPROC (20 + 16 * 32)
#define NPROC_PER_UID (NPROC/2)
#endif

/* NOTE: maxproc and hard_maxproc values are subject to device specific scaling in bsd_scale_setup */
#define HNPROC 2500 /* based on thread_max */
int maxproc = NPROC;
int maxprocperuid = NPROC_PER_UID;

#if CONFIG_EMBEDDED
int hard_maxproc = NPROC;   /* hardcoded limit -- for embedded the number of processes is limited by the ASID space */
#else
int hard_maxproc = HNPROC;  /* hardcoded limit */
#endif

and while this may be scaled in bcd_scale_setup (if you are running server version), hard_maxproc is always taken as upper limit according to syslimits.h

#if !defined(_ANSI_SOURCE)
/*
 * Note: CHILD_MAX *must* be less than hard_maxproc, which is set at
 * compile time; you *cannot* set it higher than the hard limit!!
 */
#define ARG_MAX        (256 * 1024) /* max bytes for an exec function */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define CHILD_MAX          266  /* max simultaneous processes */

You must log in to answer this question.

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