How to close the Terminal automatically on macOS
If you are a regular user of the shell script on macOS you will notice that after completing the process it does not automatically close the Terminal, but the user must turn it off manually. Therefore this article will show you how to close the Terminal automatically after completing the process.
This method only works when you launch the shell script outside bash such as clicking on it on the Finder or setting a custom hotkey to open the program. If not, you will be taken back to the Command Prompt. You can use the killall Terminal command to close the Terminal application from the script but it will close all open Terminal windows.
- How to customize Terminal on Mac
- 5 best alternatives for Terminal application on macOS
- Use commands and some tips for Mac OS X
Change behavior from Profile settings
Open the Terminal application from Dock or the Applications folder, then open the installation by pressing Command + Comma .
In the Settings window, go to the Profiles tab. Here, the default profile is always selected. In the settings on the right, click on the Shell tab and then click on the drop down menu When the shell exits .
By default, the option Don't close the window is selected, but you can change it to Close if the shell exited cleanly .
You can close this Terminal window all the time, but will receive an error message if the exit process is in non-zero exit status. Note, you need to exit the script with the exit command so that this behavior works at all times.
If launched from the Finder, the exit command will automatically add to the script.
Use iTerm
- https://www.iterm2.com/
iTerm2 is a popular Terminal replacement application for macOS, which automatically closes the window when the shell script exits. If you have used iTerm as the default Terminal, you can see that the shell script starting from the Finder remains open with the original Terminal application. So you still have this problem unless you have set it to open with iTerm.
You can change the application to open the script by right-clicking the script in the Finder and then selecting Get Info .
You will see a drop down menu to change the script open application, select iTerm and click Change All to apply changes to the scripts.
By default, if you open the iTerm window, it will launch in a separate tab, not a separate window, and the tab will close automatically when the process is complete.
I wish you all success!
You should read it
- Windows Terminal can now automatically launch configurations as administrator
- How to use Terminal on a Mac
- How to customize Windows Terminal application
- Notable changes in Windows Terminal ver 0.11
- 8 best free Terminal Emulator apps for Android
- How to make Windows Terminal the default Terminal application and its benefits
- How to fix the problem of being unable to enter Terminal in Linux
- Top 5 useful Terminal tips for Mac users
May be interested
- Clean up Mac screens with Stacks featureapple has introduced a feature called stacks in macos mojave that helps you organize document files on the desktop.
- How to use 'Hey Siri' on an old Macalthough apple has provided siri features for older macs, it hasn't provided the 'hey siri' activation function for all macs that support siri.
- How to right click on Macyou are wondering how to right click on a mac? read this article to learn how to do it.
- How to turn Caps Lock keys into modifier keys on Macmany computer users find the caps lock key useless, they rarely or even not use it for a long time. this is how to make caps lock keys more useful on mac.
- 5 beautiful mobile wallpaper download sites for macOS Mojavewith the advent of macos mojave, mac users can now use animated wallpapers instead of static backgrounds like before.
- How to use Hey Siri on a Macthe latest version of apple's hey siri feature can be found in some of apple's recently announced mobile products, including fifth-generation ipad mini, third-generation ipad air and 3rd generation airpods. two.