Ask Different is a question and answer site for power users of Apple hardware and software. 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

When I want to close a window I type exit :

 mbp-thomas in ~
○ → exit

[Opération terminée]

Then cmd + w to close the window.

Is there a way to do it with a little script like if I type quit it exit the session then close the window ?

share|improve this question
Can you configure Terminal to close when the shell closes? – glenn jackman Jun 10 '14 at 15:11
@glennjackman that's a damn good question ! I'll try it right now – Thomas Ayoub Jun 10 '14 at 15:12
@glennjackman post it as an answer, you'll win +25 – Thomas Ayoub Jun 10 '14 at 15:13
While the question already has a great answer, a quick tip on the side: CTRL-D does the same as typing exit and hitting ENTER, but is much quicker. Also works when logging off a remote server in an SSH session. – ssc Jun 13 '14 at 20:07
up vote 13 down vote accepted
  1. Open Terminal.

  2. Go to TerminalPreferences….

    Image of the Terminal panel

  3. Select the Settings tab, then your profile, and choose the Shell tab.

  4. Set When the shell exits to Close if the shell exited cleanly.

    Close if the shell exited cleanly

share|improve this answer

You could also simply quit Terminal by using Cmd+Q

share|improve this answer
He did not ask how to quit terminal. This is not answer to his question. – AllInOne Jun 12 '14 at 21:00
True, and while it is technically and semantically different, for all intents and purposes, that is what's happening, except if there are multiple instances open (or wants an app without window processes running). – Hugo Jun 16 '14 at 2:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.