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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
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:
ulimitcommand. You can view current limit by running
ulimit -aand set a new limit, e.g.,
ulimit -u 1000to set the max proc limit to 1000. This limit remains until the current termian session ends.
/Library/LaunchDaemons/limit.maxfiles.plist(only OS X 10.9+).
For more detail see this answer.