Macos – Mac os x 10.7.4 process limit

launchctlmacmacosprocessulimit

I have a 709 max user process. I want to double it, or more.

First: ulimit

> ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

ok, then :

> sudo ulimit -u 1418
Password:

let me check …

> ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

nope !

Then, with launchctl

> launchctl limit
    cpu         unlimited      unlimited      
    filesize    unlimited      unlimited      
    data        unlimited      unlimited      
    stack       8388608        67104768       
    core        0              unlimited      
    rss         unlimited      unlimited      
    memlock     unlimited      unlimited      
    maxproc     709            1064           
    maxfiles    256            unlimited 

with or without sudo, I typed:

> launchctl limit maxproc 1418 1418

checking …

> launchctl limit
    cpu         unlimited      unlimited      
    filesize    unlimited      unlimited      
    data        unlimited      unlimited      
    stack       8388608        67104768       
    core        0              unlimited      
    rss         unlimited      unlimited      
    memlock     unlimited      unlimited      
    maxproc     709            1064           
    maxfiles    256            unlimited 

hasn't changed !

Finally, just checking with another command :

> sysctl -a | grep proc
kern.maxproc = 1418
kern.maxfilesperproc = 10240
kern.maxprocperuid = 1418
kern.aioprocmax = 16
kern.procname = 
kern.maxproc: 1418
kern.maxfilesperproc: 10240
kern.maxprocperuid: 1418
kern.aioprocmax: 16
kern.procname: 
machdep.cpu.processor_flag: 0
security.mac.proc_enforce: 1

The limit here is not even true. The real limit, I've verified it, is 709 proc.

I'm very angry right now. I got some work to do and this damn mac doesn't let me do it.
Questions :
– how can I upgrade that number ?
– will it cause some domage to my system ?
– why a number limit in the first place ?

Best Answer

I was experiencing the same behavior on 10.6.8, so I gave the solution from this post a shot.

Create the following files if they don't exist, and then add/modify the following lines. (paraphrased)

sudo vim /etc/launchd.conf

limit maxproc 512 2048
limit maxfiles 512 unlimited

sudo vim /etc/sysctl.conf

# Turn up maxproc
kern.maxproc=2048

# Turn up the maxproc per user
kern.maxprocperuid=1024

# Remove core files
kern.coredump=0

Worked perfectly for me. I expect it should also work on more recent versions of OS X, as well.

Cheers