Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know it's just a pet peeve, but I hate it that Mac OS X's stays open when it has no windows open. Is there any way to make it close when its last window is closed?

Since I don't see any option inside Preview to make that happen, I imagine that the answer might be applicable to other programs that have similar … idiosyncrasies.

I realize that this is not outside the OS's interface guidelines. That is, I recognize that this isn't a bug that will be fixed. I'm wondering if there is some way to automatically close selected GUI applications that have no windows open.

share|improve this question
up vote 15 down vote accepted

Try RedQuits:

RedQuits is there to help if you have ever tried to close an application with its red button and wondered why it is still open. With RedQuits, all programs now quit when there's only one window left for that program. If you want to quit and close all open windows of a program, just uncheck "Quit only when 1 window is left for that app." in the preferences.

share|improve this answer
What's funny is RedQuits itself doesn't quit when you press the red button, says so in the instructions. It's simple, which is nice, but no white list. – Michael Ozeryansky Jan 6 '13 at 18:02

In short: No.

--Answer stops here. Everything following is just my attempt to explain why.

What you are experiencing is the Mac philosophy of how applications should behave. Those who are closed after the last window dissapears are not behaving to Mac Interface Guidelines (though there are a lot out there). // Edit: This is not entirely correct, see posts below.

It has been that way since the very first Mac System (in 1984). I guess it'll stay with us for another 25 years to come. Maybe app devs will allow us to set that in the preferences.

Until then it helps getting used to Command-Q (the Apple key and q) to quit each and every app - and Command-W for just the active window.

share|improve this answer
My personal opinion as a comment: Working with both platforms every day: I got used to it. Doesn't make that much difference at all and - as always - there are two sides to it. While the app is running, each subsequent start is super-extremely-quick. Those apps that I use just once in a while could just as well be closed right after I use them. I got used to Apple-Q/Apple-W on the Macs much faster than Alt-F4/Strg-F4 on the Windowsers. – Wolf Oct 11 '09 at 16:26
One can also press Q while using Command-Tab to switch applications (thus while still holding down Command), to quit the application that is currently highlighted in that application switcher. – Arjan Oct 11 '09 at 16:32
+1 for Arjan's comment. It's an amazing way to close a huge number of apps at once. You do this whenever you need to free up some memory. – Dan Rosenstark Oct 11 '09 at 17:22
What really, really annoyed me was that minimized apps showed up in the app switcher, but wouldn't be restored if choosing them. That I found very inconsistent. Just recently - after literally years of usage - I came across pressing ALT while switching to the (minimized) app would restore it. Hooooray!!! – Wolf Oct 11 '09 at 20:46
To be brutally honest, I'm not all that interested in whether or not the symptom is normal. I'm interested in how to get rid of the symptom. – wfaulk Oct 12 '09 at 16:26

I wrote an AppleScript application to do this for you.

In brief, it checks what applications are open, gives you the option to whitelist apps to be excluded from auto-quit, then every 60 seconds, quits all applications (that it can, due to limitations).

To alter the whitelist while it's running, click the icon in the dock for the selection dialog to reappear.

To quit, right click the Dock icon and choose "Quit"

AppleScript source and Application:

share|improve this answer
Seems like a good idea, except it doesn't work. I had to change "name" to "displayed name" in refreshWindowedProcess() to keep it from asking "where is this application", but even then it doesn't seem to ever quit anything. – wfaulk Oct 27 '09 at 3:37
What version of OS X are you using? I wrote my script under Snow Leopard, not sure if there have been major changes to AppleScript. – Kio Dane Oct 27 '09 at 17:00
Nevermind, OmniGraffle Pro just did it to me. Very funny those cases were the name in Finder is not the actual file name... I'll see if I can write a correction to this using the bundle identifiers instead. – Kio Dane Oct 27 '09 at 17:06
Updated using bundle identifiers instead of application name (which can be different than the application's filename). In the source, there's a note about two lines commented out that will report the list of windows in each bundle identifier. I notice that many applications report having at least one window open despite no visible window being open. NetNewsWire is one such app having a long list of windows even after the main window is "closed". The Hit List is another app that retains it's single window is always open. – Kio Dane Oct 27 '09 at 19:15
Count of Windows = 0 seems the most obvious way of detecting your state for quitting, but this does not seem to do the job for all apps. Come up with your own conditions to add to my code. Since not all applications have an AS dictionary, it will be hard to check those apps for any other conditions (let alone time consuming to make a separate rule for each one). I'm more inclined to agree with the other answers given of "It's part of the Mac Culture to have a headless application still running" Unless it's doing something, it's not gonna be taking up much CPU or physical RAM. – Kio Dane Oct 27 '09 at 19:16

The automatic termination feature introduced in 10.7 partially addresses that for some applications.

If you open Preview, open at least one window in it, close all windows, and switch to another application, Preview is hidden from the Dock and application switcher. If you look at Activity Monitor, the process is still running and uses memory, but there might be some changes in how the process is managed.

The Mac App Programming Guide says that processes are actually terminated, so there might be something I'm missing.

  • Automatic termination eliminates the need for users to quit an app. Instead, the system manages app termination transparently behind the scenes, terminating apps that are not in use to reclaim needed resources such as memory.


Automatic termination transfers the job of managing processes from the user to the system, which is better equipped to handle the job. Users do not need to manage processes manually anyway. All they really need is to run apps and have those apps available when they need them. Automatic termination makes that possible while ensuring that system performance is not adversely affected.

share|improve this answer
Preview certainly doesn't automatically disappear for me under those conditions on 10.7.4. – wfaulk Dec 18 '12 at 17:18
I missed your comment earlier, but it does for me in 10.8.2. Did you open at least one window (like open and close the preferences window) before hiding Preview? – user495470 Mar 10 '13 at 1:34

Another free small and simple app, Quitter, displays an X icon in the traybar which acts just like the closing button under Windows.

share|improve this answer
Welcome, and thanks for posting an answer! You should disclose your affiliation with the linked product/blog. It's not usually a problem when everything is kept above board :) – JoshP Dec 17 '12 at 16:07

override the following method in NSApplicationDelegate (which normally returns NO):

-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSapplication*)sender { return YES; }

share|improve this answer
This is a question about how users might make this happen to existing applications, not how a programmer might get his program to do it. Thanks for your effort, though. – wfaulk Jun 23 at 20:52

You must log in to answer this question.

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