May 11, 2006

bash: fork: Resource temporarily unavailable

Posted in Mac OS X at 11:00 am by intermediatemacintosh

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.

Try this:

## check the number of processes allowed per user id.
## (OSX default is 100)
ulimit -u

## 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 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: