0

How to close a window without the application quitting? does not address my question, strangely. I don't want to hide the application windows like Cmd+h does, and Option+click didn't actually do anything for me, and isn't what I want anyway.

I work with a lot of different application windows, especially with the browser and the terminal (I'm a software engineer and run my coding editor, debuggers, servers, etc. from the terminal and am constantly switching between term windows and tmux sessions to develop/troubleshoot our solutions). Sometimes (actually, most of the time), when I finish with a session, I want to close the window without closing the application. I make heavy use of keyboard shortcuts, so it interrupts my flow to have to grab for the mouse and point->click the corner to close the window.

Is there a way to get a shortcut to close windows in OS X without closing the entire application? This is really interrupting my flow and productivity.

I'm using Mavricks, btw. I've also tried iTerm2 and the default Mac Terminal but couldn't find anything that lets me do this in either of those applications. Chrome also doesn't seem to support closing just a Window. Either terminal is fine, I have things configured to the point where tmux eliminates my need for a fancy terminal, because Tmux can do it anyway, plus some.

6
  • and the minimize does not work for you ?
    – Ruskes
    May 1, 2015 at 16:08
  • I don't want to minimize the window, I want to close it. Is this not a concept in mac, getting rid of a window entirely without quitting the application? Why would a I want a bunch of unused windows running in the background eating up system resources when I don't need to do that? Scenario: I open up a temporary term window to perform a debugging task that, when I'm finished with, I won't need that window any more. It does not make sense to minimize that window because I won't be using it again - it's a one time task. However, I have other terminal windows open that I still need.
    – josiah
    May 1, 2015 at 16:10
  • Thanks for clarifying your needs. So something like closing all background windows except the one in focus would not be it. Not sure I understand the Chrome comment, you can close individual tabs.
    – Ruskes
    May 1, 2015 at 16:30
  • Most - but not all - apps will stay open when you close the last window - Chrome is one of them, idk about iTerm. Exceptions include Preview.
    – Tetsujin
    May 1, 2015 at 16:36
  • Chrome aside (since it can be done) are you talking about closing your Debug windows?
    – Ruskes
    May 1, 2015 at 16:47

2 Answers 2

5

Have you thought for a keyboard combination like cmd+w?

In Google Chrome you can close all tabs with cmd+shift+w, in Safari the same way.

Alternatively you can write an AppleScript like tell application "Terminal" to close front window or as terminal command: osascript -e 'tell app "Terminal" to close front window'.

3
  • cmd+w is the command I was looking for. It was hard to find, though - I had visited multiple sites and everyone mentions cmd+q but nobody mentions cmd+w. Same, when I open the Window menu in the top bar, for the Terminal and Chrome cmd+w is not mentioned there, and neither is it mentioned in the View menu. Really, I would have thought this common command would have been documented better.
    – josiah
    May 1, 2015 at 18:57
  • @Josiah - Cmd/W was already mentioned in the link you posted.
    – Tetsujin
    May 2, 2015 at 9:53
  • So it is mentioned there... Must be going blind.
    – josiah
    May 4, 2015 at 18:50
0

This could also help you for the same. cmd + option + w

1
  • This does close all the windows; however, on some applications (like Apple Notes) the entire application will automatically quit if there are no windows open. Is there any way to prevent this? Dec 9, 2019 at 23:07

You must log in to answer this question.

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