By default, after finishing with a macOS terminal session, the terminal window will not gracefully close. Instead a terminal session will remain open until you close the window with your mouse, or when you close the terminal application.
So in this video, we demonstrate how you change the behaviour of the terminal window, so that when you type Exit into a terminal session, the terminal window automatically closes.
Quick reference notes:
- From your macOS desktop, select Spotlight Search.
- Within Spotlight Search type Terminal and press Enter on your keyboard.
- Now from the Terminal’s menu bar select Preferences.
- Within Preferences choose Profiles.
- From the sidebar Profiles, select your default profile.
- Now select the Shell tab
- Under the option “When the shell exits”, select from the drop down menu Close if the shell exits cleanly.
- Close the Preferences window.
Wikipedia article – Terminal (macOS)