Skip to content

Instantly share code, notes, and snippets.

@jamesstout
Last active January 6, 2017 08:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesstout/4546975 to your computer and use it in GitHub Desktop.
Save jamesstout/4546975 to your computer and use it in GitHub Desktop.
Xcode/clang: error: unable to execute command: posix_spawn failed - How to check for zombie processes on Mac OS X
#!/bin/bash
# to check for zombie processes on Mac OS X
for pid in `ps -v -u james | awk '{print $1, $2}' | grep Z | awk '{print $1}'`;
do
ps -o command="" -p $pid >> ~/zombies.txt;
done
# Detect if file exists
if [ ! `test -e ~/zombies.txt` ]; then
# this gives you the zombied commands
cat ~/zombies.txt | sort | uniq
# this gives you the number of zombied commands
wc -l ~/zombies.txt
rm ~/zombies.txt
else
echo "No zombies found"
fi;
##########################
# other useful commands
# list max processes per userID
# sysctl kern.maxprocperuid
# list all user limits
# ulimit -a
# increase/set max processes per userID (if you want)
# sudo sysctl -w kern.maxprocperuid=1024
# then add this to your .bash_profile or .bashrc and restart a new shell
# ulimit -u 1024
# also change Finder’s limits
# sudo launchctl limit maxproc 1024
## Temporarily increasing the max user processes isn't a real fix
## The only real solution at the moment is to reboot your Mac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment