How to pause and resume programs in OS X

If a program is using excessive CPU, you can pause it without quitting the program.

OS X Daily has recently unearthed a neat trick in OS X, that enables you to easily pause and resume running processes. 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. Instead of quitting the program, you might simply like to pause it for a short while.

One of the commands in the Terminal is the "kill" command, which is commonly used to force-quit a running process by its process ID (PID).

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."

While the default use of these commands is to fully exit (and thereby kill) a running process, they can also be used to send other signals (abort, interrupt, etc.) to running processes and affect their behavior. These options are generally only useful to developers and administrators, but there is one that offers a quick way to pause a program and thereby immediately halt its code execution.

To do this, open the Terminal and run the following command (note that the quotes around "AppName" are not needed unless the program's process name has a space in it):

killall -STOP "AppName"

For instance, to stop iTunes in its tracks you would run "killall -STOP iTunes" and any songs playing in the program will freeze in place. To then resume the program, simply run the following command:

killall -CONT "AppName"

killall command pausing and resuming programs in OS X
Initially iTunes is using 23.6% CPU (red). After running the command to pause it (blue) the CPU usage drops to 0.0%, and when resumed iTunes picks up and returns to 23.2% CPU usage. Screenshot by Topher Kessler/CNET

If these commands give you an error that no matching processes were found, you may need to look up the exact name of the program you are trying to target, as its process name may be different than that of the program package. You can look this up by opening the Activity Monitor program and sorting the list by "Process Name." Additionally, with any process name that has a space in it, be sure you have surrounded the full name with quotes.

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.

Additionally, when the program is paused it will not send any acknowledgement messages to the system, and therefore will appear to be in a hanged state. As such, you will likely see the spinning color wheel cursor when you hover your mouse over the program. However, keep in mind this will only affect the program and not the window server, so you should still be able to drag the program around on-screen (though you will not be able to resize or minimize the window).



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Don't Miss
    Hot Products
    Trending on CNET

    HOT ON CNET

    Looking for an affordable tablet?

    CNET rounds up high-quality tablets that won't break your wallet.