How to close terminal (iTerm) on Mac OS after [process completed]

An annoying default setting for the main Terminal app of Mac OS ( iTerm ), is that after a certain process is terminated the tab or window remains open with the message [process completed]. Example below.

When managing multiple windows/tabs, time is of the essence and closing the tab manually takes time + moving your hands to the mouse/trackpad.

Luckily, you can change this behaviour quite easily from the iTerm settings, amending your default profile.

  1. Open iTerm preferences from “Terminal” — “Preferences” as shown below. You can also use the shortcut Command + , (comma symbol).
Open iTerm preferences

2. From the iTerm Preferences, switch to the “Profiles” tab and then locate your default profile, as shown below.

Find your default iTerm profile

3. Finally, change the default behaviour of the option “When the shell exits” to “Close if the shell exited cleanly”, as shown below.

Select the new option

All done! Now the iTerm tab (or window if you only have one tab) will close automatically as soon as your scripts exits without errors.

Co-founder @Lnk.Bio — Developing stuff on the Web since 2003

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrea Olivato

Andrea Olivato

Co-founder @Lnk.Bio — Developing stuff on the Web since 2003

More from Medium

The Best Application for Command Line To-Do List Management

Stop Starting your Commands with Dollar Signs

Mac Terminal(shell)

Clearing cache Microsoft Teams — MacOs (making it work)