Category Filter

Script to Force Close Apps on Mac

When your app gets struck on your Mac, you can force close the app and all its running processes with a single line of script from the Mac Terminal. This is an extremely useful command as it allows you to close the app without having to interact with the system GUI and also obtain diagnostic notes to assist in further troubleshooting.

Device admins can remotely run scripts on Macs managed with Hexnode using the Execute Custom Script action.

Scripting Language – Bash

File extension – .sh

Disclaimer:


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Force close an app

Example – killall –v Notes

The killall command is used to kill processes running on the system.

You may add the following options to the command –

-d – Print detailed information about the matched app processes but do not kill the processes.

-v – Show the process ID killed.

-l – List the names of all available signals and exit. The signal TERM or terminate signal is used by default. You may use another signal by specifying with the -SIGNAL option.

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.