Skip to content

Instantly share code, notes, and snippets.

@christoph-jerolimov
Last active December 24, 2015 20:29
Show Gist options
  • Save christoph-jerolimov/6858302 to your computer and use it in GitHub Desktop.
Save christoph-jerolimov/6858302 to your computer and use it in GitHub Desktop.
Kill iPhone Simulator. First friendly, afterwards not so friendly.
if ! pgrep "iPhone Simulator"; then
exit 0;
fi
pids=$(pgrep "iPhone Simulator")
osascript -e 'tell app "iPhone Simulator" to quit'
sleep 1
for pid in $pids; do
if ps $pid; then
sleep 4
kill $pid
sleep 1
fi
if ps $pid; then
sleep 4
killall -9 $pid
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment