
PURPOSE
This macro, Quit Applications Selectively, can be used to quickly close all, or a subset of all, open macOS applications.
Note that this macro only quits applications that are visible when using ⌘+Tab. (In AppleScript this is: set appsOpen to name of every process whose background only is false)
If one or more of the open applications have unsaved changes, the typical warning dialog(s) will appear, thus this method is as safe as interactively quitting an application.
Macro Setting
Initial Prompt With List
Confirmation Dialog
MACRO SETTING
local_AppsToConsiderForExclusion : Used to specify applications that are often excluded when quitting others.
The foreground application and this setting, combined with the list of open applications, determines the applications that appear in the initial Prompt With List.
By default, the value of this setting is:
Arc
iTerm2
Keyboard Maestro
Script Debugger
The application name required is not always obvious, for example with iTerm.app, iTerm2 is required. Thus this macro includes an alternate mode that can be used to assist when configuring this setting:
- Open the applications that you want to include in local_AppsToConsiderForExclusion.
- With the command key (⌘) held down, trigger this macro from the Keyboard Maestro editor.
- A dialog similar to the following will appear.
ALTERNATE MACRO BEHAVIOR
You can start Quit Applications Selectively and bypass the initial Prompt With List by calling it from another macro that includes an Execute a Macro with one of the following With Parameter values.
With Parameter |
Macro Function |
|---|---|
0 |
all apps |
-0 |
all apps‡ |
1 |
all except foreground + AppsToConsiderForExclusion |
-1 |
all except foreground + AppsToConsiderForExclusion‡ |
2 |
all except AppsToConsiderForExclusion |
-2 |
all except AppsToConsiderForExclusion‡ |
F |
all except foreground |
-F |
all except foreground‡ |
>%local_Whitelist% |
all except whitelist |
->%local_Whitelist% |
all except whitelist‡ |
‡Run without displaying the confirmation dialog (see above). For example, -0 will quit all applications with no required user interaction (unless one of the apps has unsaved changes).
In addition, you can start Quit Applications Selectively, but exclude the foreground application from the initial Prompt With List.
With Parameter |
Macro Function |
|---|---|
!F |
exclude foreground from selection list |
Finally, when configuring the variable in Quit Applications Selectively, you can use:
With Parameter |
Macro Function |
|---|---|
? |
list open apps is a dialog |
This dialog can also be displayed by triggering Quit Applications Selectively from the Keyboard Maestro editor with the command key (⌘) held down.
TESTED WITH
• Keyboard Maestro 11.0.4
• Tahoe 26.0.1 (25A362)/MacBookPro18,2
VERSION HISTORY
- Initial version
MACRO DOWNLOADS
Quit Applications Selectively.kmmacros (98.9 KB)
Macro-Notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System Information
- macOS 26.0.1 (25A362)
- Keyboard Maestro v11.0.4




