If one holds down Option and Control whilst clicking an icon in the Dock, the resulting menu contains a Hide Others command, such that only the clicked application is visible on screen. This is helpful when making a presentation, recording a screencast, or in other circumstances. The one problem is that the programs running in the background can still generate errors, etc., that might awkwardly cause them to reappear during the screencast, presentation, etc.

Would it be possible to create some sort of command (or Service, or something) to "Quit Others" -- that is, a command that would quit all applications except the frontmost one?

2 Answers 2


Using the SO answer referenced by Diago, maybe something like the following modification can exclude the currently active application:

tell application "System Events"
    set the visible of every process to true
    set app_name to name of the first process whose frontmost is true
end tell
set white_list to {"Finder", app_name}
    tell application "Finder"
        set process_list to the name of every process whose visible is true
    end tell
    repeat with i from 1 to (number of items in process_list)
        set this_process to item i of the process_list
        if this_process is not in white_list then
            tell application this_process
            end tell
        end if
    end repeat
on error
    tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
end try

Then you can add this as a service using Automator, and assign a keyboard shortcut for it in the Keyboard section of System Preferences.

  • @Matt Swain, did you just put together this post, or is there an error somewhere in the system? Because I was just trying to answer my own question, following Diago's lead, and when I clicked submit, this answer appeared, but attributed to you. But either we wrote the same thing, which is entirely possible, I suppose, or somehow my post got attributed to someone else.
    – Daniel
    Mar 16, 2012 at 15:50
  • @DanielL Yeah I wrote this post - can't see your post, but if like you say it was very similar to this, then maybe it was automatically filtered? Weird.
    – Matt Swain
    Mar 16, 2012 at 16:24
  • OK, wow, you used a different variable name than I did. What you called appname I called current_process. We just had the same idea. Well, well done.
    – Daniel
    Mar 16, 2012 at 16:29

There is an answer on SO about this Quit All Applications using Applescript? with code for an AppleScript that can quit all applications. I would guess it just needs to be modified to check what the active application is and then installed as a service on the Mac. There is an article about the latter available here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .