Jump to content

Quitting and Force quitting for more than one application at the same time.

Recommended Posts

The "Force quit applications" is a nice OS X built-in application.  The great thing is you can select more than one application at the same time.




I would like to be able to use Alfred and its "quit" and "force quit" commands to quit more than one application at the same time.

In other words, selecting more than one application just like I can select more than one file/folder with the "buffer" feature. 

One could use the same modifiers keys of the buffer feature.


In practice: 


1°) I open Alfred search bar,

2°) I type "quit",

3°) I select all the applications I want to quit with the modifier key (for example: Alt+Up arrow),

4°) I hit Alt+Right arrow, then hit Enter,

5°) The selected applications close.



Link to comment

That's a very low effort attempt. You haven't even added the File Action I told you you needed.


Here's a script that will kill the applications passed to it. Put it in a Run Script with Language = /usr/bin/osascript (JS)


I'll leave you to figure out the File Action for yourself.

// Extract name of application from path
var appRegex = new RegExp('.+/([^/]+)\\.app$', 'i')
var sys = Application('System Events')

// Return application name based on path passed in by Alfred
function getAppName(path) {
  var match = appRegex.exec(path)
  return match[1]

// Check the name we guessed is the right one
function validateApp(path, name) {
  var procs = sys.processes.whose({name: name})

  for (var i = 0; i < procs.length; i++) {
    var proc = procs[i]

    if (proc.applicationFile().posixPath() == path) {
      return true

  return false

// Kill running applications
function run(argv) {

  argv.forEach(function(path) {
    var name = getAppName(path)

    if (!Application(name).running()) {
      console.log(`${name} is not running`)

    if (validateApp(path, name)) {
      console.log(`killing ${name} ...`)
      var app = Application.currentApplication()
      app.includeStandardAdditions = true
      app.doShellScript(`killall -SIGKILL "${name}"`)
    } else {
      console.log(`guessed the wrong name for ${path} :(`)



Link to comment

You are right it is a low effort attempt. I can explain you why. I tried to create a workflow in the middle of the night while having a cold and a neighbour partying like crazy. The party was so loud I didn't understand what I was reading on my computer... I am not looking for excuses. Just explaining the context :) I also want to add it is 


Thank you for the script. 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...