• On Metacritic: Heavy Rain: The first reviews are in
advertisement
May 9, 2008 8:15 AM PDT

When force quit doesn't work

by CNET staff
  • Font size
  • Print
  • 18 comments

Mac OS X's force quit mechanism can be a boon when an applications freezes,

often consuming a large amount of system resources as it flails. However, force quits do not always execute properly, leaving hung or stalled applications in their problematic states.

As described by user Jude Kim on the Apple Discussion boards:

"After an application hangs forever, I tried to force quit. I get the message popup window saying that the application has been forced quit unexpectedly or something like that. But even after that message, there's still a blue light under the application. I can't restart the application and most annoyingly, I can't shut down the computer unless I shut it off with the power switch. I had this problem since I got this computer, please help me."

Fortunately, Apple's "Force Quit" dialogue box is only one of the many ways to approach targeting a process to kill it. Alternative Approaches include:

Activity Monitor Use Activity Monitor to display a list of all the running processes on the computer. You can see if one is displayed improperly or if it's using up large amounts of resources, and then kill it specifically to see if that clears the hang. (see this article for more)

The Terminal Use the terminal to kill a process by PID (Process ID). The PID can be looked up several ways, but the most common are to use Activity Monitor or the command line equivalent "top". Using the command line is a more basic approach to killing the process.

In some cases -- in which a single application causes the Mac OS X kernel to become extremely busy and slows the system to a halt -- having a Terminal window open can prove beneficial.

If you are lucky enough to have a Terminal window open, and can switch to it, you can kill processes that you otherwise would not be able to (since it's virtually impossible to launch Activity Viewer or the Terminal after a thrashing -- freezing -- process starts).

When the freeze ensues, switch to the Terminal window then type the following command:

top

and press return.

You'll be presented with a list of currently running processes. Scan down the "COMMAND" column for Safari (or whatever application is causing the issue) and note the number next to it in the "PID" column. Once you've found the PID, press the Q key to exit the top program, then enter the following command, replacing (PID) with the actual number -- without parentheses:

kill (PID)

and press return.

With any luck, the thrashing will stop and you'll be able to re-grain control of the computer -- or at least gain enough responsiveness to access and save currently open work.

Force shutdown If things get worse and you need to force a shutdown of the whole system, try the following: Instead of using the Finder's menus to shut down, try using the terminal to issue the shutdown command. Open it and type "shutdown -h now" (or "shutdown -r now" for a reboot).

Preventative Measures

Since the problem seems to occur for specific programs, that indicates the problem may lie with the program or some of it's resources. Many times a preferences file or other resource could get corrupted so the program has a hard time reading it.

Try removing the program's .plist file and restart the program. Such .plist files will generally be located in the ~/Library/Preferences folder, and labeled as follows:

  • com.(name of developer).(name of product).plist [For instance, com.adobe.Reader7.0.plist for Adobe Reader 7.0].

Simply drag the potentially offending .plist file to the trash, re-launch the hampered application, and check for continuation of problems. In some cases, applications will have several .plist files, so make sure you check for any that contain the product name. Also, note that you may lose some settings or other personal data used by specific applications when these files are deleted

You can also use Spotlight to find other files the program has created in your user library folder, and remove or delete them. Note that doing this most likely will get rid of your personal settings for the program, but most of the time re-entering them in the program's settings will set things up properly again. Additionally, this is only safe for applications that are bundled in one package. Many complex programs put vital items all over the place when they install, and removing them could break the program or reduce its functionality. - if the program has built-in maintenance tools, run them. For instance, Safari has a "Reset Safari" feature that clears caches, cookies, history, and preferences.

Finally, you can remove and reinstall the whole program. Hopefully the program came with an uninstaller script or utility. If not, you can use AppZapper which helps target a particular application's installed resources for easy removal.

Note that an application can hang for multiple reasons, and unfortunately it isn't always the program itself that's the problem. For instance, OS X has an automatic spell checker that's accessed by many programs. If something goes wrong with the spell checker, then any program that accesses the spell checker may hang along with the spell checker.

Feedback? Late-breakers@macfixit.com.

Resources

  • Jude Kim
  • this article
  • AppZapper
  • Late-breakers@macfixit.com
  • More from Late-Breakers
  • Recent posts from MacFixIt
    Apple releases Aperture 3.0
    Manage iCal's automatic e-mail generation for invitations
    CNET TV Apple Byte: Apple faces critics
    Weekly Utilities Update: Net Monitor, MiniUsage, TimeMachineEditor, more...
    Odds and Ends: Essential video codec packs for OS X
    Address Book: Unable to add, view contacts
    Persistent 'Faster Browser Search' overtaking Safari's default search
    Quick tip: Faster Time Machine backups
    Add a Comment (Log in or register) (18 Comments)
    • prev
    • next
    by MAC_1984 May 9, 2008 8:49 AM PDT
    By far the best way to rid an application is not App Zapper, but File Buddy. App Zapper is too rudimentary, but better for novices.
    Reply to this comment
    by Rick Auricchio May 9, 2008 9:15 AM PDT
    If you're in Terminal and want to force-quit, it's best to first try a straight kill (pid). If that doesn't work, use kill -9 (pid).

    There are some situations where even this won't work. A process can be blocked in an I/O driver or elsewhere in a kernel function, and even kill -9 won't do the job.
    Reply to this comment
    by rahja May 9, 2008 9:15 AM PDT
    >
    This is a reply to a previous comment by Rick Auricchio


    I think that someone did: kill -MacFixit Forums...
    Reply to this comment
    by ra0711.yu May 9, 2008 9:15 AM PDT
    >
    This is a reply to a previous comment by Rick Auricchio


    Sometime, My finder hang due to the connection to smb is dropped (The windows server is shutdown). I even cannot use command "kill -9" to force quit the program.
    How to fix this scenario without force shutdown the Mac.
    Thanks.
    Reply to this comment
    by musicMMan May 9, 2008 10:09 AM PDT
    A last ditch option is to press and hold the power button until the machine closes down. Sometimes even that wouldn't work, but since my G5 and Leopard (probably back to Panther, actually) the press and hold has allowed immediate shutdown. Not the most elegant, but the most effective short of pulling the plug or battery (on a laptop.)
    Reply to this comment
    by Almond May 9, 2008 10:09 AM PDT
    I was previously aware of both the activity monitor and terminal solution, so I've put both of those applications in my startup items.

    However, lately I've run into a curious problem in which the shutdown process doesn't recognize that the process it is trying to shut down has quit.

    The sequence of steps goes something like this:
    1) For some reason I begin to suspect that something is not right (last night it was corrupted icons), so I save my work, and select "Restart" from the Apple menu.
    2) For all of the processes, I haven't quit manually, it will pause for about 1 minute, and then give me a message such as "Shutdown canceled because XX wouldn't quit", where XX is the name of a process (e.g., X11, Quicktime Player, TextEdit, ..., Activity Monitor, Terminal, Finder).
    In each case, it looks like the process has properly quit, and selecting "Restart" again will cause the next one in line to quit and pause.
    3) Eventually, I'll get to the point where the only thing left running is the Finder (and maybe the Dock). At that point Finder will quit and the machine will just sit there (I don't think it is quite frozen, but no program is running to accept the user input).
    4) Pressing on the power key brings up a shutdown dialog, but pressing restart send the machine back into the same wait state.

    The only way around this I've found is holding the power button down to force a power off. I can then reboot and the system seems to work normally.

    I'm running MacOS 10.5.2 on a MacBook Pro, and I have Default Folder (version 4.0.5 I think) installed. I also tend to leave my machine on but asleep most of the time, rebooting only rarely.
    Reply to this comment
    by Rick Auricchio May 9, 2008 10:09 AM PDT
    >
    This is a reply to a previous comment by Almond


    There are cases where the process has quit interacting with the keyboard and screen but can still be stuck running. Terminal users might find that process with the PS command, but it's a good chance they're not killable anyway.
    Reply to this comment
    by John Sawyer May 9, 2008 10:09 AM PDT
    >
    This is a reply to a previous comment by Almond


    Activity Monitor, and its associated process pmTool, can use, on average, about 20% of a single processor's processor time, so on slower Macs, you might not want to run Activity Monitor all the time.
    Reply to this comment
    by Fingal May 9, 2008 11:40 AM PDT
    I have used Terminal to try to get out of freezes on many occasions but it's not always as easy as it seems. Often the reason that an application won't quit is that it's depending on another process which is frozen. SystemUIServer seems to be a common culprit but it can be quite a guessing game, killing processes until either the machine unfreezes or becomes completely unusable, even through the terminal. Sometimes the real solution turns out to be to unplug a FireWire device.

    The top line of Top gives information about how many processes are running, stuck or sleeping. Is there a way to find out which processes are the ones which are stuck? I don't see anything obvious in the man page for top about how to do that.
    Reply to this comment
    by John Sawyer May 9, 2008 11:40 AM PDT
    >
    This is a reply to a previous comment by Fingal


    Sometimes, the process that's stuck, is the one shown in top's %CPU column, that's taking up an unusual amount of processor time.
    Reply to this comment
    by John Sawyer May 9, 2008 2:02 PM PDT
    There's sometimes another use for Activity Monitor for dealing with stuck processes: some people find that just opening Activity Monitor sometimes wakes up a stuck process. If it doesn't, sometimes selecting the process from Activity Monitor's list of processes, and then selecting Activity Monitor's options to either Inspect or Sample the process, will wake it up. Some people say this is mythological, but I and many other people have seen this work.
    Reply to this comment
    by pecos-bill May 9, 2008 2:30 PM PDT
    I've found that doing a second force quit often works. The one in Activity monitor seems to do the -9 flavor (NOHUP???) which is the one that cannot be ignored. Should save a trip to Terminal. If something is waiting for a disk that's dying, nothing will get an app to respond.
    Reply to this comment
    by okeanos May 9, 2008 2:30 PM PDT
    >
    This is a reply to a previous comment by pecos-bill


    -9 is SIGKILL. Terminate with extreme prejudice.
    Reply to this comment
    by mike_jalkut May 10, 2008 1:20 PM PDT
    Or you can access "ForceQuit" with control-option-click on the app's dock icon

    Mike Jalkut
    Reply to this comment
    by Rob Hahn May 10, 2008 2:01 PM PDT
    You don't need to hold down the control and option keys when selecting an open app in the dock, just hold down option as you click to see the Force Quit item.

    Also I'm surprised no one has mentioned a key combination that has worked for me many times when I can't Force Quit the usual ways: Hold down Shift-Option-Command-ESC and keep holding it until the app quits.
    Reply to this comment
    by Simon J.A. Simpson May 12, 2008 4:44 AM PDT
    I'm very interested in learning more about the Spell Checker. Is this something to do with Hogwarts and that Harry Potter used ?
    Reply to this comment
    by Steve Hunt May 12, 2008 4:44 AM PDT
    >
    This is a reply to a previous comment by Simon J.A. Simpson


    A few observations.

    First off, the Force Quit command does not always have the desired effect the first time it is issued. In my experience it is usually worth trying a second time if the first time doesn't do the job.

    The amount of CPU time used by the Activity Monitor depends on the update frequency you choose. I have it open most of the time and keep the update frequency set to once every 5 seconds (anyone know of a way of reducing the frequency even further?)

    The 'kill' command should be used with care, especially when you are killing a system process. Killing system processes requires super-user access (either by logging in as root, or by running an su shell, or by using the sudo prefix) for this reason. It is unlikely that you will do any permanent damage, but if you have to kill a system process to relieve a freeze then it's a good idea to re-boot the system after you have performed any necessary data recovery. (The 'shutdown' command also requires super-user access)

    If the GUI becomes unresponsive there may be no way of switching to an application that will allow you to force quit any rogue processes. However, if the machine you are working on has Remote Login switched on you may be able to kill - or to shutdown the whole machine - remotely. You should be able to make an SSH connection from another machine and run kill, or shutdown, as if you were logged in via Terminal.

    ---
    Steve4Fluff
    Reply to this comment
    by James P Reid May 12, 2008 4:49 PM PDT
    I have found that many of the application hangs are cause by USB/Firewire devices. After a force quit has be initiated, try unplugging all your USB/Firewire devices and see if the application(s) is/are successfully shutdown.
    Reply to this comment
    (18 Comments)
    • prev
    • next
    advertisement
    Click Here

    About MacFixIt

    MacFixIt is CNET's troubleshooting resource for all things Mac. The information here helps you navigate the ins-and-outs of Mac ownership with how-tos, troubleshooting information, news, reviews, and more.

    Add this feed to your online news reader