Force quitting application to shut down computer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
01-06-2020
12:53 PM
- last edited on
03-04-2025
03:14 AM
by
kh-richa_mig
Has anybody successfully forced quit an application that a student left on and 'didn't save' their work so the computer could be shut down?
some apps are notoriously bad at quitting when there's something they think needs to be saved and this prevents the Mac from shutting down.
Any help would be appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-06-2020 01:38 PM
It's absolutely possible, and directly killing the process (not sending a quit command to the app) works in every situation I've experienced.
Alternately, "shutdown -r now" will force an immediate restart regardless of what's running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-07-2020 08:12 AM
@fsteffy, I use the script on this post: https://www.jamf.com/jamf-nation/discussions/17649/force-quit-all-apps-script. I have computers that are scheduled to restart daily. Before the scheduled restart I created a policy that ran the script first.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 08-04-2021 06:07 AM
@joethedsa can you post you code, the script on the link provided does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 08-04-2021 12:51 PM
@tkimpton, Sure thing. Here is the one that I use:
#!/bin/bash
#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
