Terminal Shell preferences
Use Shell preferences in Terminal to set the startup or exit behavior of shells. To open this pane, choose Terminal > Preferences, click Profiles, then click Shell.
To run a command when the shell starts up, select “Run command,” then enter the path to the command.
To have the command run inside the shell, select “Run inside shell.”
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
You can receive an alert before processes are terminated.
To display an alert before any process is terminated, click the Always button.
To terminate the process without an alert, click the Never button.
To terminate the listed process without an alert, but to provide an alert before terminating any process that’s not in the list, click the “Only if there are processes other than the login shell and:” button.
To add a process to the list of processes that can be terminated without an alert, click the Add button , then select the process.
To remove a process from the list of processes that can be terminated without an alert, select the process, then click the Remove button .