3

Sometimes when I am using Git and cannot do a sudo command, it reports

fork: Resource temporarily unavailable

What does this mean, and what should I do about it?

1 Answer 1

1

This fork error usually means the parent program was unable to execute one-or-more child processes because a resource limit was reached, either the maximum allowed number of processes (the EAGAIN error) or maximum allowed amount of memory (ENOMEM error). The man page of Fork(2) says:

 Fork() will fail and no child process will be created if:

 [EAGAIN]  The system-imposed limit on the total number of processes under execution would
           be exceeded.  This limit is configuration-dependent.

 [EAGAIN]  The system-imposed limit MAXUPRC (<sys/param.h>) on the total number of pro-
           cesses under execution by a single user would be exceeded.

 [ENOMEM]  There is insufficient swap space for the new process.

There are several ways that limits are imposed on OS X:

  • Per-session limit set by the ulimit command. You can view current limit by running ulimit -a and set a new limit, e.g., ulimit -u 1000 to set the max proc limit to 1000. This limit remains until the current termian session ends.
  • System limits are set using launchd, in a file at /Library/LaunchDaemons/limit.maxfiles.plist (only OS X 10.9+).

For more detail see this answer.

You must log in to answer this question.

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