📢 Newsroom Update

The iPhone 16 and iPhone 16 Pro lineups, Apple Watch Series 10, the new black titanium Apple Watch Ultra 2, AirPods 4, and new colors for AirPods Max are now available! Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple ID, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Not applicable in Mac OS X Server v10.8 (Mountain Lion)?

This chart seems not applicable in Mac OS X Server v10.8.4 (Mountain Lion) [Server v2.1.1].


I have 32GB of RAM but the maxproc limit is still 2500, no matter setting via launchctl (the new way), sysctl (the old way), ulimit (the soft way), or both of them.


Commands applied:

$ sudo launchctl limit maxproc 2501

$ sudo launchctl limit

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 2500 2500

maxfiles 1048576 1048576


$ sudo sysctl -w kern.maxproc=2500

kern.maxproc: 2500 -> 2500

$ sudo sysctl -w kern.maxproc=2501

kern.maxproc: 2500


Files also created / modified accordingly:

/etc/launchd.conf

/etc/sysctl.conf


When I see the source code of the Darwin kernel (unix_startup.c), it works like it is specified here. But I still cannot I wonder whether the kernel calls srv_setup() and bsd_srv_setup() properly. I would like to find a way (via systemsetup command, modifying com.apple.Boot.plist, applying NVRAM parameter, etc.) so that bsd_srv_setup() would be called with a larger "scale" parameter. Or perhaps is there any way to compile a custom kernel from source and replace the system one?

iMac, OS X Server, Mac OS X v1.8.4, Server v2.1.1

Posted on Jul 12, 2013 8:41 PM

Reply
9 replies

Jul 15, 2013 9:55 AM in response to asukakenji

According to Apple, as is stated in the KB article you linked to, the OS dynamically scales the maximums for you. However, it's not clear if it scales up/down based on installed memory or memory currently in use on the system.


Have you tried running some tests against the system to see if the maxproc the system returns increases when your system's use of memory increases?


At this low level in the system I think you'll get the best answer from filing a radar with Apple through your Developer Account.


I have a system here with 96GB of RAM. I'll try to take a look at it later to see what it's doing.


Gil

Jul 16, 2013 2:57 AM in response to boyonwheels

Would you please explain what you mean by "currently used on the system"?


If you refer to "the sum of the amount of memory used by all applications", I think the behaviour would be ridiculous. That means if I want to increase the value of "maxproc", I am going to create a dummy process that "eats" sufficient memory? Besides, the documentation states "installed memory", not "used memory".


By the way, here is what "top" (the "top" command) says:


Processes: 124 total, 4 running, 2 stuck, 118 sleeping, 577 threads

Load Avg: 0.45, 0.31, 0.26 CPU usage: 0.23% user, 1.6% sys, 98.69% idle

SharedLibs: 15M resident, 12M data, 0B linkedit.

MemRegions: 24353 total, 1816M resident, 62M private, 436M shared.

PhysMem: 2172M wired, 3219M active, 1097M inactive, 6488M used, 26G free.

VM: 319G vsize, 1062M framework vsize, 325423(0) pageins, 0(0) pageouts.

Networks: packets: 6925013/7909M in, 5238935/2270M out.

Disks: 138964/2538M read, 676309/24G written.


Thanks for helping! And please tell me if you need more information / command results.


Kenji


Message was edited by: asukakenji (adjusted the font size of the "top" output)

Jul 16, 2013 11:31 AM in response to asukakenji

I didn't mean to imply that you should start processes to eat memory on your system to increase limits as a solution. I was curious from a "test it and see what happens" perspective.


Anyhow, reviewing your original question I think you're running into the issue because your syntax is wrong. Your command was:


sudo launchctl limit maxproc 2501


But, the syntax for that command requires that you specify both a soft limit and a hard limit. So, for example, it should look something like this:


sudo launchctl limit maxproc 1501 2501


On my system this appeared to work correctly. Hopefully that puts you on the right path!


Gil

Jul 16, 2013 12:18 PM in response to boyonwheels

D'oh. Hit reply a little too soon and had to run to a meeting. Here's what I did and saw in terminal:


% sudo 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


% sysctl kern.maxproc

kern.maxproc: 1064


% sudo launchctl limit maxproc 709 1000

% sudo 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 1000

maxfiles 256 unlimited


% sysctl kern.maxproc

kern.maxproc: 1000


Note that use of sudo matters. If I run sysctl limit without sudo the results returned are different:


% 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


So, it looks like Mac OS X is user-process focused when making these changes. As you probably already know, most processes on the system have launchd as a parent. If you change the limits on launchd then all of it's children will inherit those limits. But, the man pages lead me to think that they will only inherit the limits of launchd at the time they are sqawned.

Jul 16, 2013 7:07 PM in response to boyonwheels

Gil,


The command with one parameter (known as "both" in manpage) is the same as the one with two parameters (known as "soft" and "hard" respectively in manpage) - it will be treated like supplying two parameters using the same value:


$ sudo launchctl limit

Password:

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 2500 2500

maxfiles 1048576 1048576

$ sudo launchctl limit maxproc 1000

$ sudo launchctl limit

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 1000 1000

maxfiles 1048576 1048576

$ sudo launchctl limit maxproc 2500

$ sudo launchctl limit

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 2500 2500

maxfiles 1048576 1048576

$ sudo launchctl limit maxproc 2501

$ sudo launchctl limit

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 2500 2500

maxfiles 1048576 1048576



By the way, my iMac is running Mac OS X 10.8.4 and the manpage is dated "1 May, 2009" in case if it matters.

Jul 16, 2013 7:21 PM in response to boyonwheels

Gil,


I have tried your command:


$ sudo launchctl limit maxproc 1501 2501


The result is:


$ sudo launchctl limit

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 1501 2500

maxfiles 1048576 1048576


You can see that the "hard" limit is still 2500, not 2501. I don't really care about if there exists both a "root" limit and a "user" limit, but I DO care about the hard limit is being "clipped" at 2500. The support page (http://support.apple.com/kb/HT3854) told me that I can go beyond that (because I have 32GB RAM installed), but I couldn't, and that's why I'm asking this question here.


Kenji

Jul 16, 2013 11:11 PM in response to asukakenji

Ah, now I see it. It looks like you can freely configure the limits... as long as you stay under 2500. Not even changing the settings through the /etc config files will make it go above 2500.


The issue is that we're both running OS X client (edit: I was running client, my bad!) To fix it you have to install set Server.app and set it to run in performance mode (serverinfo -setperfmode BOOL).


This returns the following on my 16GB system:


% sysctl kern.maxproc

kern.maxproc: 5000


% sysctl kern.maxvnodes

kern.maxvnodes: 300000


% launchctl limit

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 3750 5000

maxfiles 256 unlimited



Turning off performance mode and rebooting returns settings to the hard client default settings we've been struggling over.


% sysctl kern.maxproc

kern.maxproc: 1064


% sysctl kern.maxvnodes

kern.maxvnodes: 263168


% 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


The clue turned out to be in unix_startup.c, afterall. See the bsd_scale_setup() function for the guilty conditional.


Message was edited by: boyonwheels

Jul 18, 2013 7:01 AM in response to boyonwheels

Thank you so much!


Now I can set my maxproc to 10000 as stated in the support page (http://support.apple.com/kb/HT3854).


$ sudo serverinfo --setperfmode true

$ sudo reboot

$ sudo launchctl limit maxproc 10000

$ sudo launchctl limit

cpu unlimited unlimited

filesize unlimited unlimited

data unlimited unlimited

stack 8388608 67104768

core 0 unlimited

rss unlimited unlimited

memlock unlimited unlimited

maxproc 10000 10000

maxfiles 1048576 1048576

Not applicable in Mac OS X Server v10.8 (Mountain Lion)?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.