Skip to content

Instantly share code, notes, and snippets.

@lucasdavila
Last active December 20, 2023 12:00
Show Gist options
  • Star 56 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save lucasdavila/f382f5f5eb4fc4e83cf5 to your computer and use it in GitHub Desktop.
Save lucasdavila/f382f5f5eb4fc4e83cf5 to your computer and use it in GitHub Desktop.
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf
kern.maxproc=xxxx
kern.maxprocperuid=xxxx
$ sudo launchctl limit
$ sudo launchctl limit maxproc <maxprocperuid> <maxproc>
$ sudo launchctl limit maxfiles 512 unlimited
# run at startup
$ sudo vim /etc/launchd.conf
limit maxproc <maxprocperuid> <maxproc>
limit maxfiles 512 unlimited
@girishkalele
Copy link

A limit of 1064 processes on a 16 GB 8-core i7 Macbook is extremely low - I couldn't believe it when I first hit this "Cannot fork" issue.

@isomorphisms
Copy link

from man 8 sysctl:

 The -w option has been deprecated and is silently ignored.

@isomorphisms
Copy link

isomorphisms commented Mar 15, 2018

I also needed sudo sysctl kern.tty.ptmx_max=255 (or 511, or whatever). My default (in El Capitan) was 127. (As a tmux user, I need more than that.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment