Skip to main content
Question

Force Quit All Apps- Script?

  • October 29, 2015
  • 2 replies
  • 6 views

Forum|alt.badge.img+15

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

Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • October 29, 2015

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

Forum|alt.badge.img+21
  • Honored Contributor
  • 970 replies
  • August 4, 2021

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

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