Sometimes it becomes necessary to identify an application or process that consumes too much of your poppy resources. Usually, System Monitoring is used for these purposes, in which a greedy application is found and forcibly terminated. This method is rather crude and not entirely “humane”, since the forced termination of an application can cause data loss. Instead, it will be more convenient to use the Terminal kill command, which can painlessly temporarily suspend a process or application and then continue its execution.
How to Pause and Start an Application using PID
This method is preferred because it is actually used by default in the system, with the only difference that you can add various keys to the command that affect its behavior (in this case, the suspension of the application). Also, it allows you to quickly stop the program, which implies the termination of the execution of its code and, as a consequence, a reduction in the consumption of system resources.
First of all, we need to know the PID of the application that we are going to suspend. The PID is the process ID, the application’s numbered identifier, which is displayed on the CPU tab, in System Monitoring. For example, I have a PID of iTunes – 525 (yours will be different).
Open the Terminal (from the Programs folder – Utilities or via Spotlight) and drive in the following command (substituting the application PID):
kill -STOP PID
Immediately after that, the music will stop playing (if it was launched), and the application will be suspended. The execution of the code will stop completely and it will be considered to be hung up (the status – Not responding is displayed in the System Monitoring).
Read more: What is mdworker Process on my Mac?
To resume the application, the kill command is also used, but with a different key, here’s what it looks like:
kill -CONT PID
Note: Do not close the Terminal until you continue the operation of the application with the current PID, otherwise problems may arise in the future if you want to continue it, and the PID is already assigned to another process.
How to Pause and Start an Application using AppName
If you have any problems with the previous method or you do not want to bother with the PID, which changes every time you start the application, you can use another method that works with the application name (AppName), which, unlike the PID, is always the same.
To do this, we use the killall command with the keys we already know. We recall the name of the application or look at it in the System Monitoring and substitute it into the following command:
killall -STOP "AppName"
killall -CON "AppName"
Finally, I remind you that the killall command in its pure form (without any keys) will instantly complete any application. If these are macOS system applications, for example, Finder, Dock, they will simply be restarted.