Skip to main content

Looking for a script to force quit all user apps. We are seeing some issues with some apps being open when they get an update causing issues.

I use this code. It's killing only things in /Applications so modify as necessary.



#!/bin/sh

Force quit all non-essential applications



declare -a killPIDs
killPIDs=$(ps axww -o pid,command | grep -v bash | grep [a]pplications/ | grep -v /bin/sh | grep -v [c]asper | grep -v [j]amf | grep -v elf Service | grep -v [m]cAfee | grep -v [v]ZAccess* | grep -v grep | awk '{print $1}')

Kill said processes.



for i in ${killPIDs[@]}
do
echo "Killing PID $i"
kill -9 $i
done

exit 0

I use this code. It's killing only things in /Applications so modify as necessary.



#!/bin/sh

Force quit all non-essential applications



declare -a killPIDs
killPIDs=$(ps axww -o pid,command | grep -v bash | grep [a]pplications/ | grep -v /bin/sh | grep -v [c]asper | grep -v [j]amf | grep -v elf Service | grep -v [m]cAfee | grep -v [v]ZAccess* | grep -v grep | awk '{print $1}')

Kill said processes.



for i in ${killPIDs[@]}
do
echo "Killing PID $i"
kill -9 $i
done

exit 0


This script doesnt seem to work. Please can you have a look @thoule 


Reply