Written by Prajwal Bhattaram

My Mac is my platform of choice for a lot of the stuff I do. However, one thing that has always bugged me is how when you type

exit

into Terminal you see this: Terminal 'Exit'

No more!

For those of you who have had enough of it as well, here’s a solution.

P.S. This is not for those of you who are not comfortable with the command line interface. You must have your terminal open and follow the following steps - changing some of the text as and when indicated.

Stage I - Basics

This will do the job
  • Click on ‘Terminal’ in your status bar (next to the Apple logo) and click on ‘Preferences’
  • Select the ‘Profiles’ tab
  • Click on the dropdown menu under ‘When the shell exits:’ and select ‘Close if the shell exited cleanly’ Terminal 'Preferences'
  • Close the ‘Preferences’ window
  • That’s that. From now on, if you type exit into your terminal, not only will it exit the process, it will close the window.

Stage II - Customization

If you'd like to add a bit more flair....
  • Open your .bash_profile by typing the following command into Terminal
    nano ~/.bash_profile
    
  • Paste the following into your bash profile and save it.
    alias quit='osascript -e "do shell script \"osascript -e \\\"tell application \\\\\\\"Terminal\\\\\\\" to quit\\\" &> /dev/null &\""; exit'
    
  • You can replace the word ‘quit’ with any other command of your choice.
  • Now you can exit terminal and close the window at the same time using your own custom command!

Marzogh

Jack of many trades, master of some