You’re closing a Terminal window, only to be told that doing so will terminate a running process. Which is confusing, because you didn’t know anything was still running at all.
There are all kinds of reasons an application might be running in the background in a Terminal window, and it might not be a good idea to close the window while one is running, at least not without finding out what’s going on.
Which is where the Inspector comes in handy. With the Terminal open, hit Command+I to bring up the Inspector. Alternatively, you can click Shell > Show Inspector in the menu bar. Either way a side window will open.
This is the Inspector, and it allows you to change a number of settings. You can set a name for the currently open window, useful if you’re the kind of person who has several different Terminals open at a time, and you can change the size of the window and change the background color.
What interests us, however, is at the bottom of the window: a list of the currently open processes.
In our case we’ve got cmus, a music player, stopped in the background—I must have used Control+Z to stop the application instead of actually closing it. I could use the command
fg to switch back to the suspended program, but I’m fine just closing the application. You’ll need to recognize the program and determine whether it’s important to keep it running.
If you’d like to close a given process, right-click its name in the list, then go to Signal Process Group and click Kill.
This will close the program instantly, allowing you to close your window without worry.
If you think this is useful, consider checking out our list of Bash keyboard shortcuts for macOS, along with some just for fun tricks hidden in the macOS Terminal. There’s a lot to explore here, so dive in and learn something new. Thanks to Alyssa Ross for teaching me the above trick!