Force Quit All Apps- Script?

bwiessner
Contributor II

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.

2 REPLIES 2

thoule
Valued Contributor II

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 [S]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

tkimpton
Valued Contributor II

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