You can use apple script to quit the terminal app. Add the following to your script - osascript -e 'tell application 'Terminal' to quit' This will give you a popup confirming to close the app. You can disable this in Terminal preferences. Alternatively, you can also use killall command to quit the app. The following would work just as well. This method of force quit command Mac is especially useful if your mouse cursor is lagging a bit. Force quit using the Terminal. If you prefer a command line method to solve the problems, you can quit an unresponsive app via Terminal. Here’s what you should do: Launch the Terminal. Type the following command: killall application name. Step 2: Choose Apps to Close & Keep Open. Through the list of actions shown in the middle window, find 'Quit All Applications,' then double-click it to create a window on the right side of Automator.
Kill program Mac OSX terminal can sometimes be necessary
Even though OS X is a pleasure to work with, we have all had a program or process freeze up. It won’t quit by using “Force quit”. What do you do now? Fortunately, this can be solved quite easily. To kill program Mac OS X terminal on Leopard / Snow leopard / Lion do the following commands:
Get the ID of the program
Kill the program
This will give you the number of the processes found (if any). Now just close them with this command
So, for example to kill my activity monitor program
Now the offending program will shut down immediately, no matter what it was doing. This is, however, a last resort. You will lose any unsaved changes.
What happens behind the scenes when you kill the program is a bit different from regular operations. Normally, the operating system asks the program nicely to go away. With the above kill command, it simply shuts it down immediately without asking or telling it anything. There you go. Gone.
Has this post got you interested? Would you like to learn how to do more interesting stuff in OS X’s terminal , than just kill a program. Then read these 10 commands. Even more interested? The OS X terminal is built on top of bash, and you can read more about it in this tutorial.
Terminal User Guide
How To Close App Through Mac Terminal Space
Each window in Terminal represents an instance of a shell process. The window contains a prompt that indicates you can enter a command. The prompt you see depends on your Terminal and shell preferences, but it often includes the name of the host you’re logged in to, your current working folder, your user name, and a prompt symbol. For example, if a user named michael is using the default zsh shell, the prompt appears as:
This indicates that the user named michael is logged in to a computer named MacBook-Pro, and the current folder is his home folder, indicated by the tilde (~).
Open Terminal
On your Mac, do one of the following:
- Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal.
- In the Finder , open the /Applications/Utilities folder, then double-click Terminal.
Quit Terminal
- In the Terminal app on your Mac, choose Terminal > Quit Terminal.
How To Close Applications Mac
Quit a shell session
Open Terminal In Mac
- In the Terminal app on your Mac, in the window running the shell process you want to quit, type
exit
, then press Return.
This ensures that commands actively running in the shell are closed. If anything’s still in progress, a dialog appears.
If you want to change the shell exit behavior, see Change Profiles Shell preferences.
See alsoApple Support article: Use zsh as the default shell on your MacExecute commands and run tools in Terminal on MacChange the default shell in Terminal on MacOpen new Terminal windows and tabs on MacUse profiles to change the look of Terminal windows on MacApple Developer website: Command Line Primer