Change Profiles Shell preferences in Terminal on Mac
Use Shell preferences in Terminal to change the startup or exit behavior of the shell for a Terminal window profile.
To change these preferences in the Terminal app on your Mac, choose Terminal > Preferences, click Profiles, select a profile, then click Shell.
Note: The options you choose in this preference pane apply only to the profile you select. They don’t apply to the Terminal app in general.
Set a command to run when the shell starts up.
When the shell exits
To change the way the window behaves when the shell exits, click the pop-up menu, then choose an option:
Ask before closing
Select whether to receive an alert before processes are terminated.