How to close terminal windows on exit

MacOS’ terminal default behaviour prevents the program from closing the window after typing the exit or logout command. For a Windows guy like me this is a strange behaviour and I much prefer the other way around.
Thankfully, making it behave this way is fairly easy.

Open the terminal preferences

The first step is to open the terminal preferences. You can do this, as explained in a previous article, by clicking on Terminal > Preferences on the top bar or by pressing the keyboard shortcut ⌘ + ,.

The Terminal Preferences window.
The Terminal Preferences window.

Click the Profiles tab

Once again, the Profiles tab is our friend. Last time we worked mainly with the Text tab within it. This time, we’ll need to click on Shell.

The second option is marked as When the shell exits. Change its value to Close if the shell exited cleanly, then close the options window.

NoteNote: this setting only applies to the currently selected profile. If you change it, remember to edit that option accordingly.

End result

Here’s what will happen when you type the exit command.


About Andrea Luciano Damico 137 Articles
Andrea Luciano Damico is a freelance translator from Italy. Among his interests are linguistics, technology, video games, and generally being a chill guy. He runs Let's and