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

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