Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't fork process: Resource temporarily unavailable issue

I've got a problems with using terminal on macOS 10.12.3 on Mac mini

When I try to run any command I get the following message:

can't fork process: Resource temporarily unavailable.

I have already had such problem. Last time I was able to fix it - increase the number of process and my system looked like:

sysctl -a | grep maxproc  
kern.maxproc: 2048  
kern.maxprocperuid: 2048  


ulimit -a  
core file size          (blocks, -c) 0  
data seg size           (kbytes, -d) unlimited  
file size               (blocks, -f) unlimited  
max locked memory       (kbytes, -l) unlimited  
max memory size         (kbytes, -m) unlimited  
open files                      (-n) 65536  
pipe size            (512 bytes, -p) 1  
stack size              (kbytes, -s) 8192  
cpu time               (seconds, -t) unlimited  
max user processes              (-u) 2048  
virtual memory          (kbytes, -v) unlimited  

I thought that the problem was solved, but now I had that issue once again.

I was able to solve this problem this time with reboot - but it's strongly undesireable to reboot my mac every time.

Do you have any advise how to fix that problem once and for all?

like image 527
Ivan Okhotnikov Avatar asked Feb 26 '18 11:02

Ivan Okhotnikov


2 Answers

No idea why your question was downvoted…


sudo sysctl kern.tty.ptmx_max=255 (or 511, or whatever) should fix it.

My default (in El Capitan) was 127. (As a tmux user, I need more than that.)

To learn more:

sysctl -a | grep max
ulimit -a
launchctl limit

cat /private/etc/launchd.conf
cat /private/etc/sysctl.conf

man 8 sysctl
like image 174
isomorphismes Avatar answered Sep 21 '22 18:09

isomorphismes


Rebooting solves the issue. In my case, I opened Activity Monitor and found way too many processes for "Outlook WebContent". I quit MS Outlook and voila, the terminal reopened and that error disappeared.

like image 35
Farhad Avatar answered Sep 19 '22 18:09

Farhad