There are many things that can go wrong with applications; although I generally shy away from troubleshooting information in the book, I'm going to briefly talk about the two most common application problems: freezes and corrupt preference files.
If an application crashes, it will usually quit automatically; you can generally just relaunch it and get back to work. However, sometimes the offending application won't quit—it will just sit there, unresponsive. In this scenario, the only way to get the application to quit is using a force quit. Whereas a standard quit (one you, as the user, initiate) allows you to save documents and allows the OS to elegantly stop the application, a force quit simply kills the application on the spot. You don't get to save any open documents, and any preferences you may have set during that session may not get written to the preference file. A force quit isn't graceful, but if it's the only way to quit a misbehaving app, it's quite useful.
You can force quit an application using three methods:
Force Quit from the Apple Menu If you select Force Quit… from the Apple Menu (or press command+option+escape), you're presented with the Force Quit window (Figure 7.12). By selecting an application and then clicking Force Quit, the application will be quit immediately (you'll get a dialog asking if you're sure). If an application is frozen (crashed but won't respond), it will generally be listed in red type in the Force Quit window.
Figure 7.12: The Force Quit window
You can quickly exit the Force Quit window by pressing the escape key, regardless of whether or not you have actually force quit an application.
Force Quit from the Dock I mentioned in the previous chapter that you can quit an application from its Dock menu (control/right-click on the application's Dock icon to access its Dock menu). If you press the option key while accessing the app's Dock menu, "Quit" changes to "Force Quit." Selecting this option is identical to using the Force Quit window. Note that if an application is frozen, sometimes you won't even need to hold down the option key; Force Quit may appear in the application's Dock menu automatically.
Because of the way memory protection does and doesn't work inside the Classic Environment, force quitting a Classic application will usually quit the entire Classic Environment and all other Classic applications.
Force Quit Using Process Viewer If you launch the Process Viewer utility (/Applications/Utilities/Process Viewer), you get a listing of all running processes (Figure 7.13). To quit an application, select it from the list of running processes (you can use the Find field to find it quickly if you know its name), and then choose Processes ➣ Quit Process. You'll be presented with a dialog asking if you want to Quit or Force Quit the application; in our scenario, you'd want to force quit. You'll notice that Process Viewer lists many more processes than the Force Quit window; the latter only lists standard applications that are visible in the Dock, whereas Process Viewer lists all running processes, including background applications and system processes.
Figure 7.13: Selecting a process to quit using Process Viewer
You can also force an application or process to quit using Terminal; I'll talk about that in Chapter 15.
A corrupt preference file can cause its corresponding application to misbehave; this is one of the most common causes of application problems in OS X. Why a preference file goes bad—a previous application crash, hard drive problems, etc.—isn't as important as what to do when it happens.
As I mentioned in Chapter 2, preference files are stored in /Library/Preferences (for system-wide preferences) and ~/Library/Preferences (for user-level preferences), and generally have the name of the application in the filename. For example, com.apple.TextEdit.plist is the preference file for TextEdit. If you're having continual problems with a particular application, its preference file should be the primary suspect. Locate its preference file in the Preferences folder (you can use the Search field from a Finder window toolbar as described in Chapter 5 to find it quickly), and then drag it to the Desktop. Launch the application; if the problems are gone, you know the preference file you moved to the Desktop was the culprit, so you can delete it permanently (a new one was created when you launched the application). If the problems still exist, the preference file wasn't the cause (you can quit the application and replace the original preference file).
Note that preference files in the main /Library folder can only be deleted by an admin user.