How to Close All Apps in OS X Using AppleScript

It happens at the moment when you really need a reboot of Apple OS X. You have 50 apps open and the reboot keeps canceling. What should only take 30 seconds now takes 5 minutes. You work to close all of your apps and finally you’re able to reboot.

There’s got to be a better way, right? There is. You can use AppleScript to create a script that closes all apps at once so you no longer have to grind your teeth prior to a reboot.

Read on for the steps.

Here’s how to create the script. Don’t worry, it’s not difficult:

1. Open AppleScript from Spotlight by typing applescript in the search box.

Spotlight Search box

2. Click New Document as shown below:

New Document option in Script Editor window

3. Paste the following contents inside the AppleScript menu.

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

Code entered in AppleScript window

Duplicate contacts killing your productivity? See how Scrubly can help in this 100-second video.

4. Next, click File > Save and choose the following:

Save As: Close All
Where: Applications
File Format: Application

Save As options dialog box

Time to Test It Out

Now, the moment of truth. Go to the Applications folder and click on the AppleScript file you just created, Close All. You guessed it: all applications will be closed, right away.

AppleScript file saved in Applications folder

How’s that for easy? No more tedious manual closing of all those apps before a reboot. You can thank us later!


Scrubly sign-up.