ohmyzsh: fork failed: resource temporarily unavailable

I’m on OS X 10.8.2 after upgrading to latest oh-my-zsh I started to have these errors:

Last login: Thu Dec 20 23:36:28 on ttys002
/Users/myuser/.oh-my-zsh/oh-my-zsh.sh:4: fork failed: resource temporarily unavailable
git_compare_version:4: fork failed: resource temporarily unavailable
/Users/myuser/.oh-my-zsh/oh-my-zsh.sh:4: fork failed: resource temporarily unavailable
git_compare_version:4: fork failed: resource temporarily unavailable
/Users/myuser/.zshrc.local:53: fork failed: resource temporarily unavailable
_current_epoch:1: fork failed: resource temporarily unavailable

it turns out the problem is in on-my.zsh.sh

  # Check for updates on initial load...
  if [ "$DISABLE_AUTO_UPDATE" != "true" ]
  then
    /usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
  fi

I have changed to use sh instead of zsh and everything started to work again:

  # Check for updates on initial load...
  if [ "$DISABLE_AUTO_UPDATE" != "true" ]
  then
    /usr/bin/env ZSH=$ZSH sh $ZSH/tools/check_for_upgrade.sh
  fi

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 36 (12 by maintainers)

Most upvoted comments

This happens constantly when running an ios simulator…

Just ran into this problem when the Android emulator System UI crashed. Saw @chrillewoodz comment above about the iOS simulator and decided to kill the Android emulator. Sure enough, as soon as I killed the emulator, restarted the terminal all was fine. Very odd. Leaving a comment here for future folks who run across this issue.

Try looking for long chained processes in ps command with a tree output (in my system, ps axf prints process trees; pstree also works if you can get it). Of course you won’t be able to do that once you get the fork failed error, so you need to do that frequently enough that you catch the culprit. You can run watch in a separate terminal and take a snapshot of running processes every 5 seconds or something like that.

I just found ~1000 instances of cron running on my machine, after having to restart it this morning due to this error. Reasonably sure that’s related to the ongoing instability.

The same problem, reboot will solve.

Ya try having to do that at least once a day with a hard reboot because of this issue.

Closing both my iOS simulator and Android emulator solved this for me too. +1!