May 11, 2006
bash: fork: Resource temporarily unavailable
I’m getting this error message when I kick off a script that opens a bunch of Terminal shell scripts.
In addition, I frequently have problems opening up a DMG file because there are not enough processes available.
So I ask D Andrew Reynhout, and here is what he says.
I’d guess that they’re hitting a process limit too. Shell scripts
are convenient, but they often spawn a bunch of processes to get
their work done.
## check the number of processes allowed per user id.
## (OSX default is 100)
## try to increase it (this should fail)
ulimit -u 200
## become root and increase the user limit
(as root) /usr/sbin/sysctl -w kern.maxprocperuid=200
## exit root and try to increase it again (should work)
(as self) ulimit -u 200
To make the system limit increase persist across reboots:
## edit or create /etc/sysctl.conf, add this line:
To make the user limit increase persist across logins:
## edit ~/.bashrc, add this line:
ulimit -u 200
I expect that will solve the problem. If not, you can try
raising the limit higher. The default OSX maxproc for the
whole OS (not per-user) is 568, so you will eventually hit
a wall. This system limit can be increased in the same way,
In addition, I added a .bash_profile file with the contents of “source .bashrc”
That seems to solve the problem 🙂