Today, we’ve got quite a neat trick for all you Mac guys out there. We’ll be showing you how to pause and restart OS X applications, all using Terminal. This can really be quite beneficial, especially if you need to troubleshoot a program that’s not working properly, and is taking up a lot of CPU power.
Instead of forcing the program to quit and risking system error, you may want to simply pause the app for a little while. This can easily be achieved by using the “
kill” command in Terminal, along with the app’s process ID. This can be beneficial, especially when troubleshooting a program you are running that’s taking quite a bit of CPU power and bogging down the rest of the system. Here is a quick tip on how to pause and resume applications in OS X.
In addition to “
kill,” the system also contains the command “
killall” which targets processes by name instead of their PID, making this command a touch more user-friendly than “kill.” We’ll be showing you both methods today, so check them out.
Note: You can check out this article for more detail on the kill command.
How To Pause And Resume An App Using Its Process ID
This is the method that most people prefer to use. The actual default use of the commands is to fully exit a running process, but they can also be used to send other signals to running processes and affect their behavior (in this case pause the program). It also offers a quick way to pause a program and thereby immediately halt its code execution.
First you need to know the app’s PID (process ID.) This can be found by opening Activity Monitor and locating the PID next to the process name, as shown below:
In the example above, the PID of iTunes (which we’re going to pause) is “859” (it may be different for your Mac.)
First open Terminal from either Spotlight or “Applications -> Utilities”:
Now, simply substitute the process ID value for PID in the command below:
kill -STOP PID
For example, to pause iTunes, this command will become:
Then simply press Enter to execute the command.
NOTE: Don’t close Terminal, as you’ll need the same PID to resume the program. Again, remember that you need to leave the Terminal open, as if you don’t, you may face a lot of issues trying to resume the app later.
You’ll notice that any playing media will stop, and the app (iTunes here) will appear to be “hanging.” You will likely see the spinning color wheel cursor when you hover your mouse over the program. You can also observe the changes in the app activity using Activity Monitor.
To resume the app again, simply replace the PID value again in the command below,
kill -CONT PID
For iTunes, this command becomes:
How To Pause And Resume An App Using Its “AppName”:
If you’re having issues finding the PID of the app that you want to pause. You can also easily find the “AppName” of the app in Activity Monitor, as shown below:
In Terminal, simply run the following the command, but remember to replace “AppName” with the specific AppName you found using Activity Monitor (“Google Drive” in this case):
killall -STOP AppName
Replace the “AppName” with the name of the app.
For Google Drive, this command becomes:
Note: The quote is only required if the AppName contains space, for example, Google Drive.
To easily resume the app, enter the following command, and be sure to replace the “AppName” with the specific app name of the app you want to pause and resume.
killall -CONT "AppName"
For Google Drive:
You don’t need quotes around programs which don’t have a space in their names. For example, if you want to pause and resume iTunes using this method, you’ll enter the following into Terminal:
killall -STOP iTunes
This feature does have its uses for troubleshooting problems with the system, but keep in mind that this does force the program into a non-standard mode and may result in some problems such as interrupted network communications for downloads and chat sessions.
Remember, if you have any issues or questions, we’re glad to help. Be sure to tell us about them in the comments below.