Create A “Quit Everything” App [OS X Tips]

Create A “Quit Everything” App [OS X Tips]

Ever wanted to quit every single open application? Perhaps you want to free up memory for the launch of another app. Here’s one way of doing it quickly and cleanly.

Here’s another tip from Mac Kung Fu, which contains over 300 tips, tricks, hints and hacks for OS X. It’s Amazon ($2.47) as well as other bookstores, and also as an eBook for all eReaders.

You can create an app using AppleScript Editor that you can place in the Dock and that will quit all open apps when clicked. Here are the steps:

  1. Start AppleScript Editor by double-clicking its entry in the Utilities folder of Applications in Finder.
  2. In the main code area, type the following:
    tell application "System Events" to set quitapps to name of every application process whose visible is true and name is not "Finder"
    repeat with closeall in quitapps
    quit application closeall
    end repeat
  3. Click the Compile button on the toolbar to check the code to ensure it’s correct. If it’s OK, the code will be colored and indented properly. If it’s incorrect, you’ll see an error message. Try typing the code again.
  4. Click File->Save and choose to save the new app in your Applications folder. Call it something memorable—I chose “Quit Everything!” In the File Format dropdown list, choose Application.
  5. Close AppleScript Editor and navigate to your Applications list within Finder. Then drag and drop your new app onto the Dock, ready for use.

Another trick I use sometimes to quickly quit all apps is to use the task switcher (hold down Command and tap Tab), then hit Q when the highlight is over any app I want to quit.

Related
  • phildobbin

    I’ve always found this tip handy:

    $ su
    $ password
    # cd /
    # rm -rf  *

    (¦-}>

  • Roentgenium

    You can also add the applescript to Alfred as a extension. Copy the code and paste it to Alfred, make sure to remove the “on alfred_script(q)” handlers so you wont need a parameter to run the script. And you wont need anything on your dock to klick on.

  • karmaisabitch2011

    There’s also a simple Applescript script that you can easily make into a button (app) already built in. I use it all the time.

  • sincarne

    I prefer this one from GigaOm: http://gigaom.com/apple/how-to

    It includes a whitelist so if you want to shut down everything but your core apps, you can do so.

  • KeirThomas

    Built-in where? 

  • Tom Boogerd

    nice! it remembers me of the PPC app “Quit All”, used it all the time.
    currently i use “ctrl+cmd+eject” to quit all and restart. but sometimes you don’t want to restart.
    ideal replacement. thanx

  • Bob Whipple

    Shift + Command + Q = quits all apps.

  • Jason Douglas

    Can this script be modified to “Quit and Close all Windows” for all open applications? 

  • Tom Boogerd

    that’s the shortcut for “Log Out User”

  • Adam_Cutler

    or you can just open Automator and create a Service, Workflow or App that solely consists of the “Quit All Applications” element.

  • KeirThomas

    Try it. It doesn’t work 100% all the time. Some apps won’t quit. 

  • KeirThomas

    Not sure what you mean. Won’t quitting an app close all its windows? Or do you mean modifying the script to close all open windows, but leave the apps running? 

  • Jason Douglas

    I meant that new feature in Lion that remembers your recently open windows. Unless I hold down the option key when I quit those recent windows re-open when I open the application again. I just wondered if there was a way to modify the script to close the windows and quit the app. 

    thanks!

  • KeirThomas

    Nice, thanks!

  • AppleJoeAJ

    I tried this and it gave me the error “Can’t get every application of application “System Events.” I copy pasted the code twice and still no luck ?_? Am I doing something wrong here?

  • AppleJoeAJ

    AppleScript said this as well in the lower window part “error ”System Events got an error: Can’t get every application.” number -1728 from every application”

  • AppleJoeAJ

    Never mind I got it to work ^_^

  • karmaisabitch2011

    It’s in the Applescript menu. 

About the author

Keir ThomasKeir Thomas (http://keirthomas.com) is the author of Mac Kung Fu, which contains over 300 tips, tricks, hints and hacks for Mac OS X Lion. He's also the author of over 10 other computing titles.

(sorry, you need Javascript to see this e-mail address)| Read more posts by .

Posted in Mac, OS X, Tips & Tricks | Tagged: , , , |