Last active
January 6, 2017 08:34
Xcode/clang: error: unable to execute command: posix_spawn failed - How to check for zombie processes on Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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