Mac reports an error zsh: fork failed: resource temporarily unavailable (reasons and solutions)

Mac report ZSH: fork failed: Resource Permanently (reason and solution)
MacOS version: 10.15.3 (19D76)
A few days ago, I used django-crontab to do the timing task and forgot to delete the task, which led to the continuous creation of processes in the background, and finally the terminal kept reporting errors, and the new browser and files could not be opened.
Check the following command to see that there are 1000+ processes in the background

 ps -ef | grep cron | wc -l

The solution
During this period, try to close crontab directly, but cannot close it all the time

sudo /usr/sbin/cron stop # 关闭命令
cron: cron already running, pid: 177

Final solution
First of all, empty the crontab task, delete what was created by what, for example, I passed django-crontab
So the command to remove the task is python crontab remove
Then batch delete the cron process

ps -ef | grep /usr/sbin/cron |grep -v grep | cut -c 9-15 | xargs sudo kill -9

Solve it!!
The Mac exception occurs because the thread or open file exceeds the system limit. If such an exception is reported as an error and is frequent, and the restart does not work, you need to consider whether there is some program frantically starting the process in the background. Don’t go to modify the Mac thread/file limit, to find the root cause, if indeed because development demand process, then can consider to modify the Mac itself limits, otherwise just solve the abnormal surface, but the process is still on your background, constantly eat your system resources.

Read More: