Prevent Mac Disasters
The mixed-up menus. The sudden crashes. The ever-spinning beach ball. They’re all signs that your Mac is headed for trouble—maybe big trouble— if you don’t do something soon.
OS X tends to be more stable than some other operating systems I could name, but it’s not indestructible. Properly maintaining your Mac can ward off disasters that could leave your comfortable digital environment in ruins. And Mac maintenance is easy—there’s even software that does most of the work for you. A little effort is all it takes to keep your technological house in order.
Why: Most OS X applications store preference information in XML files. Sometimes these files become corrupted, which can lead to undesirable results such as crashes and odd-looking menus. Verifying your preference files is a good way to eliminate unexplained crashes.
When: Primarily after you notice unexpected behavior, such as crashes, menu corruption, or other oddities.
If your e-mail program quits while loading, if your Web browser forgets your settings, or if Address Book loses its categories, the application’s preferences file may be corrupt. You could simply delete the corrupted file outright, but then you’ll lose custom preferences, which you must restore by hand or from a backup. Save yourself trouble by first verifying the corruption.
OS X uses .plist files to store application- and system-related preference information. These files are text files saved in the XML format, which follows a set layout. So it’s easy to determine whether a file is corrupted: if it doesn’t adhere to the set XML layout, it’s corrupted.
There are two ways to check XML preference files. In OS X 10.2 and later, you can use the Unix utility plutil. Just open Terminal and type the following:
sudo plutil -s ~/Library/ Preferences/*.plist—and then press enter and provide your password when asked.
In the preceding code,
-stells plutil to suppress output of a successful test, so if you see output, you’ll know that it’s from an error. You need to use sudo because some preference files, such as those from Micromat’s TechTool, are owned by the system even though they reside in the Preferences folder in your user folder.
You can check the top-level system preferences by repeating this command with
/Library/Preferencesas the folder location.
If you’re not fond of Terminal, try Jonathan Nathan’s free Preferential Treatment application ( ). It lets you check user-level and system-level preferences by clicking on a couple of buttons. It’s a bit slower than Terminal, but it’s much easier to use, and its results are easier to read. It lets you opt to open, move, or trash any corrupted files it finds.
An application may create a file that fails Apple’s test but is not corrupt. If you see a file or two listed for applications that seem to work just fine, you can safely ignore the warnings. If you find a truly corrupted preference file (and don’t have a corruption-free backup), quit the application, trash the file, and start over with the application settings.
Why: OS X uses a permissions system to determine which programs and folders a user can access. Sometimes these permissions are mistakenly modified, and you can’t access folders or programs. Repairing disk permissions restores the correct permissions, allowing access to folders and applications.
When: Depending on your download habits, as often as once a week or even every day.
Who: Anyone who regularly downloads and installs trialware and shareware.
Say your word processor tells you that it can’t save the file you’ve been working on for an hour, that your e-mail program won’t let you change its preferences, or that you can’t even launch an application. These are all symptoms of permissions gone bad.
Different files and folders at different locations on your hard drive have different permissions. Although OS X’s permissions system works well most of the time, default permissions can become corrupt. This happens most often after you install software that includes system-level components, or when you update the OS.
To repair broken permissions, launch Disk Utility (Applications: Utilities), click on your startup disk, and then click on Repair Disk Permissions. (Don’t bother running Verify Disk Permissions—it takes just as long as Repair Disk Permissions, and if it tells you that it found permissions errors, you’ll then want to run Repair Disk Permissions anyway.)
This process can take as long as 15 minutes; while Repair Disk Permissions is working, you’ll see messages about items it has corrected. When it’s done, any permissions issues that affect system-level files and folders on your machine will have been resolved. (For an apparent exception, see “Even Perfect Disks Have Imperfect Permissions.” )
Repair Disk Permissions uses internal data, as well as data in the top-level Library: Receipts folder, which keeps track of software you’ve installed. Never delete anything from this folder.
Your permissions-repair schedule should depend on how often you run installers. The more often you run installers, the more often you should run Repair Disk Permissions. I recommend that you repair permissions weekly if you download and install a few programs a week.
Delete Cache Files
Why: Cache files are temporary receptacles for data that help OS X and its applications work faster. They can become corrupted or simply too large to function well. If you’re experiencing odd issues with an application—such as preferences that won’t load or menus that contain strange characters—or if an application or the system seems sluggish, it may be a cache-related issue.
When: Removing cache files once or twice a month works well for most people, but if your Mac is always on and working, you may want to remove cache files once a week to prevent corruption.
A cache is a place to store something temporarily so the OS or a program can retrieve and use it in a hurry. G4 and G5 processors have caches that help them handle instructions more quickly. OS X uses disk-based caches that hold copies of graphics, frequently performed calculations, and the contents of dynamic menus. Caches help reduce application launch times, speed up the display of screen data, and make Web sites load faster.
You’ll find OS X’s cache files in the System: Library: Caches folder, in your user folder’s Library folder, and in folders within individual applica-tion folders. The easiest way to remove most of them is to use one of the tools listed in the “Managing Mac Maintenance” chart. (Except for Safari’s caches, these tools generally don’t affect application-specific caches; you’ll have to wrangle these files yourself.)
Managing Mac Maintenance
|Price||Runs Built-In Scripts||Schedules Built-In Scripts||
|Deletes Disk Caches||Deletes Log Files||
|Checks SMART Status||Schedules SMART Checks||Other Features|
|$80||•||•||Rebuilds directories and saves data from damaged disks|
|$9||•||•||•||Intelligent scheduler runs scripts during idle time.|
|Free||•||Displays scripts' output in its window as they're run|
|Free||•||•||Lets you set how often to monitor and set notification method.|
|$15||•||•*||•||•||•||•||Lets you enable Dock shadow; alternative genie mode; Finder tweaks.|
TechTool Pro 4
|$98||•||•||Comes with many hardware diagnostics.|
|Free||•||•||Lets you schedule cache removals via iCal events.|
Panther Cache Cleaner
|$9||•||•||•||•||Lets you manage login items and tune Internet connection.|
|Free||•||•||•||•||•||Lets you run Terminal commands; Finder tweaks.|
|Free||•||•||•||•||•||Lets you view log files and browse Unix main pages.|
* Registered version only.
Regularly deleting your cache files is a good idea. And if you’re seeing slowdowns or other unexplained behaviors, there’s no harm in trying to rout the bad behavior by deleting the cache files.
Delete Log Files
Why: Log files record system- and application-related activity. They grow over time, using disk space to store data you’ll never need.
When: Log files don’t normally grow excessively large, so you can delete them only when you want to reclaim drive space.
Who: Users concerned with freeing every bit of available drive space, and users who make extensive use of FTP, Web, and other bundled Unix applications.
As you work, your OS and applications automatically create log files that record everything from the mundane to the important. Large log files don’t cause system instability, but when diminishing disk space becomes a concern, there are a couple of ways to clean up.
Like cache files, log files are stored in several places, from the system level (in the /var/log and /Library/Logs folders) to your user folder (~/Library/Logs). You can run OS X’s built-in daily, weekly, and monthly maintenance scripts to take care of the system-level log files. To root out log files at the user level, you need either the Console application (in Applications: Utilities) or an application such as NoName Scriptware’s CacheOutX.
In Console, delete any log listed in your user folder’s Library: Logs folder by highlighting it from the left-hand Logs column and pressing Command-delete. After you confirm your action, that log file vanishes. Your Mac automatically re-creates it the next time the system or the program needs to write something to the log.Permissions are complicated. On the left, the user can read from and write to the user’s Home directory without restriction. In the center, the user and the admin-level user can read from and write to the Applications folder—the folder isn’t owned by the user. On the right is the OS X System folder, to which not even the admin user has write privileges.