The OS X menu allows exit, minimize and maximize:

enter image description here
I know the following shortcuts:

Exit: command+Q
Minimize: command + M
Maximize: ?

When I use command+Q to exit the behavior differs from clicking the red button. I want the UI to close and the application to remain running. Instead, the application exits entirely.

How can I accomplish this with a keyboard shortcut?

  • 1
    sounds like the answer to your question is command + W for most applications... I think that should be marked as the right answer Commented Jul 7, 2017 at 19:02
  • @GarrettSimpson - Why is + W better than + h? I've been using + h for several years now with success. I can't think of a reason to switch to +W. And I don't see a clear explanation in any answer. Commented Jul 7, 2017 at 20:01
  • i said that because command + h hides all the windows for a program, but command + W closes the open window, which is what happens when you press the red button. You can try it out yourself with multiple windows in chrome. Commented Jul 13, 2017 at 23:50

7 Answers 7


You always have the option to hide the active program. When the application in question is active (in front of all others) there are 2 options:

  1. option +click on the Desktop
  2. command +h

The first option always works or at least I can't think of any exceptions this minute. The second is supported by most applications.

In either case:

  1. Your session will be preserved.
  2. Neither will cause these windows to be displayed in the Dock where the minimized programs are located.
  3. You'll need both hands.

So, if you're scanning eBay at work, you'll likely only look suspicious. But, if you lean into it and use + (command+tab) PLUS +h in succession, you might actually look like you're doing work.

But, in the event you're asked to bring your browser back to the forefront you'll be busted. It will display exactly what you were looking at when you hid it.

You can imagine how I know this :-)

  • I experienced much success with ⌘+h! Commented Aug 20, 2014 at 16:53
  • Glad to pass it along :-)
    – todd_dsm
    Commented Aug 21, 2014 at 6:53

Typically, an application will offer a way to both close the UI and quit the application. These are usually standardized to command ⌘+W to close the UI/window and command ⌘+Q to quit the application.

Some applications will still quit entirely when you use command ⌘+W, such as Preview. You can usually rely on this shortcut to close the window without quitting, however.

I should also point out that the red button in the top left does not "quit" the application as you mentioned in the question body. It will close the window (just like command ⌘+W).

  • 1
    In tabbed apps Cmd+W closes the current tab. In such cases Cmd+Shift+W usually closes the current window.
    – Tamlyn
    Commented Oct 14, 2015 at 10:53
  • 1
    This should be marked as the correct answer Commented Jul 7, 2017 at 19:01

command ⌘+W will close the application's window, leaving the application running in the background.

There are a few exceptions to this (iPhoto, etc) but the majority of applications will have this behavior.

  • I'm a bit confused because, if I open activity monitor and App Store, and then use cmd+w to 'close' app store (or the red cross), then it still disappears from Activity Monitor, leading me to think that it has been quit.
    – timhc22
    Commented Mar 31, 2020 at 15:40
  • tabs only ... two windows each with tabs ... is not the same
    – mjs
    Commented Dec 13, 2023 at 10:38

You can use command ⌘+H to hide one entire application. Only the dock item will be visible. However, it's better to have an app, that uses a menubar item ("Menubar App") and allows you to completely hide the dock item while running.

  • jesus what an answer .. did you read the question?
    – mjs
    Commented Dec 13, 2023 at 10:38

'Alt F4' on Mac

I recently started working with Mac and this was the first thing i researched. Its surprising that no one knows of this command even tho its in the official 'docs'.

  • cmd + shift + w --> closes window with its tabs

apple shortcut page

  • Best answer for chrome, but still not equivalent to clicking on the cross for all apps
    – A21z
    Commented Nov 24, 2014 at 23:52
  • well its a shortcut ;-) you probably want to do this when you have to instantly close all tabs in that window without aiming the mouse to the close button.
    – yamm
    Commented Nov 25, 2014 at 8:08
  • The question is how can you have the same behavior as clicking on the red button with a shortcut. Cmd+Shift+W is the exact answer for chrome, but mot app won't support this shortcut. I am still looking for a shortcut that has this behavior in all apps
    – A21z
    Commented Dec 1, 2014 at 23:26
  • thats not for non tab applications
    – mjs
    Commented Dec 13, 2023 at 10:38

It depends on the type of application

If the application is multi-document (.g Safari, Preview) i.e. can have several different documents open in several windows then command ⌘+W will close the current window and leave the application running (until possible it is shut down if the OS needs more resources)

If the application has just one window e.g. App Store, System preferences then closing the window will also close the app. Thus command ⌘+W and command ⌘+Q do the same


I've found it annoying that none of the keyboard shortcuts seem to be quite the same as window close. I ending up binding hyper+w to hs.window.focusedWindow():close() in Hammerspoon and that works

You must log in to answer this question.

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