When I use applications such as TextEdit and Preview, the application still stays open after I close the text file or jpg file. When I click the respective application (since it is still in the dock), the application prompts me with a window to choose a file to Edit/Preview. Is there a way to configure these applications so that when I close the text file or the picture, the application itself closes and I can avoid seeing that window?

For instance, this is the window that I see for TextEdit after I open and close a txt file with TextEdit, and then open the TextEdit application on my dock:

enter image description here

  • 1
    When I close the last window in either of the applications you mention, it closes the whole application for me (disappears from the Dock). Do you have either or both of these applications set to Keep in Dock? – tubedogg Aug 19 '13 at 0:21
  • tubedogg, no, the icon is in the Dock because the application is still open. tubedogg, you can try it out yourself to see what I mean. Click a picture in Preview or open up a text file in TextEdit and then close it. You will see that Preview or TextEdit is still open in your dock. When you click the application that is open in your dock, you will see a screen similar to the picture I posted in my question. – sameetandpotatoes Aug 19 '13 at 0:23
  • I understood the question, and what I'm saying is since Mountain Lion (maybe Lion, but I never used Lion), Preview.app disappears from the dock as soon as I close the last window. Same for TextEdit.app. This seems to be the intended behavior (see here and here, amongst others), though the second link shows at least one user who experiences it as you do. – tubedogg Aug 19 '13 at 0:38
  • The only time I get the screen you show is if I open TextEdit.app without a document (I.e. launch the app directly, not by opening an associated document). – tubedogg Aug 19 '13 at 0:42
  • 1
    Honestly I'm not sure - I was just asking about the "Keep in Dock" setting because I assumed the apps disappeared after the last window was closed for everyone. Using a third-party app does seen to be the only solution that I've been able to find. – tubedogg Aug 19 '13 at 1:04

If you want to disable showing an iCloud-centric open dialog when you for example open TextEdit or Preview, you can either disable syncing documents and data from the iCloud preference pane, or use this unexposed preference:

defaults write -g NSShowAppCentricOpenPanelInsteadOfUntitledFile -bool true

There are some third party applications like RedQuits that make closing a window quit an application. RedQuits only applies to closing windows by pressing the close button though. There is a noticeable delay before it quits an application, and it doesn't support excluding applications like Mail.

10.7 also added support for automatic termination, which as far as I know just means that applications that have no open windows are hidden from the Dock and the application switcher under certain conditions. If you for example open Preview, open at least one window in it, close all windows, and switch to another application, Preview is hidden from the Dock and the application switcher. The process is not actually terminated, but there might be some changes in how it is managed.

  • Disabling the iCloud preference pane is probably my best option, since that will stop the window in my picture above from appearing; instead, I will see a new txt document. I guess this is one thing on OS X that I will never get used to. You're right, though; this might change with Mavericks. – sameetandpotatoes Aug 19 '13 at 14:15

Long answer: See https://stackoverflow.com/questions/5268757/how-to-quit-cocoa-app-when-windows-close

Short answer: It is a feature that is enabled/disabled by the programmer. It is not (usually) something that can be changed by a user.


My question for you is how exactly are you closing the application? In the Windows world, closing the file, for example, a text file opened in Notepad, will close Notepad entirely. In the Mac world, this is not the case. Closing the file closes only the file, while the app stays opened. This has been the way of Macs since I can remember.

Command-Q will close the app entirely, and not only that, it will keep the state of the app intact. So, using TextEdit as an example, if you had three text documents opened, and you close TextEdit, those same documents will reopen next time you open the app. Clear as mud, huh?

  • 2
    The user wants the application to auto-quit when the last window is closed - not have to manually quit and have the application state restored. As noted in the question comments, for many users auto-quit is the new norm for Preview.app and TextEdit.app but for some it doesn't work that way. – tubedogg Aug 19 '13 at 1:11
  • Yes, I notice the behavior the OP is seeking. However, since Panther at least, the behavior is that closing the specific document or JPG (in the case of the OP) does not close the app. That's what I was noting. – Dave Aug 19 '13 at 1:20
  • As a caveat, there is a feature in Lion and ML that automatically closes some apps that are no longer in use. (Some apps, not all. I believe TextEdit is one of those apps.) – Dave Aug 19 '13 at 1:21
  • 1
    Dave, if that is the case, how do I enable that feature? Because it is not working for me. As stated by tubedogg in this link, I tried this command, defaults write -g NSDisableAutomaticTermination -bool FALSE, thinking that somehow automatic termination was disabled, but this did not have an effect on TextEdit. – sameetandpotatoes Aug 19 '13 at 1:28
  • @Dave TextEdit and Preview both are part of autotermination. – tubedogg Aug 19 '13 at 1:36

You must log in to answer this question.

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