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
- How to install Hyper Terminal in Ubuntu 20.04hyper is an open source application supported on all three major platforms: windows, linux, and macos. in this tutorial, tipsmake.com will explain how to install hyper terminal in ubuntu system.
- How to scan local area network with Terminal on macOSterminal on macos is a handy tool but few people use it. this article will guide you to use terminal in macos to scan local area network for troubleshooting and maintenance.
- How to automatically close old Safari tabs - Choose when to close all tabssafari has a feature that automatically closes all old open tabs after a specific period of time, reducing the amount of space safari uses.
- How to prevent Apple Mail from automatically turning on when opening email on macOSon macos, when we open the email or click the mailto link on any browser, the apple mail application will automatically pop up.
- How to hide, display files and folders on macOSto be able to hide or show the folder again on macos, the user is forced to use a 3rd party application or use a command on the terminal.
- How to use Terminal on a Macterminal on mac is a command line interface that allows you to use unix commands to complete some tasks much faster than using a graphical user interface (gui). with the terminal command, you can open files, improve your mac's performance, and more. here's how to use terminal on mac, including some basic commands you can get started.
- 8 best free Terminal Emulator apps for Androidterminal emulator applications on android are handy when you want to execute commands within the android operating system just like on linux.
- How to open a folder on a Mac using a command in Terminalthe method of accessing folders using terminal is a bit more complicated than navigating in the finder you would normally do.
- Notable changes in Windows Terminal ver 0.11windows terminal is a command-line interface application released by microsoft in late may 2019
- How to fix the problem of being unable to enter Terminal in Linuxnothing is perfect and sometimes, even terminal can stop responding or ignore what you type. if your terminal crashes and you can't enter it, here are some of the most common causes and solutions for them.