10 essential tasks to keep Leopard purring

midijeep

Registered
10 essential tasks to keep Leopard purring

Keep Mac OS X Leopard in tip-top condition with these maintenance steps
Ryan Faas


October 14, 2008 (Computerworld) One of the big selling points for Mac OS X Leopard is that it is a stable operating system that is not prone to crashes, freezes, corrupted or fragmented hard drives, viruses and spyware, or the seemingly inexplicable performance losses typically associated with Windows. Overall, Leopard lives up to its reputation of simply working, without the need for a litany of maintenance routines and utilities to keep it going.

However, even the best-engineered car still requires the occasional oil change and tune-up to keep it running at its best. Periodically performing a few key maintenance tasks can keep Leopard -- and earlier versions of Mac OS X -- running strong and prevent or resolve problems.

1. Keep your software up to date

One of the easiest (but often overlooked) ways to keep any computer running at its best is to ensure that it is running up-to-date versions of both its operating system and any installed applications. Updates typically add new features, fix bugs, and/or patch security holes that leave the system vulnerable to viruses or other forms of attack.

While new features are usually reason enough to check for software updates, the bigger advantages in keeping your system running optimally are in the bug fixes and security patches, as both of these typically yield a faster, more stable and more secure environment.

Apple's Software Update feature provides an easy-to-use interface for updating both Mac OS X and any Apple-branded applications, such as the iLife and iWork suites. By default, Software Update is enabled and will check for updates on a weekly basis.

However, you should also keep an eye on any third-party apps or system components that you have installed. Most programs include some type of built-in mechanism for checking for updates, such as the Microsoft Auto Update utility that comes with Office or an option in an application's preferences that tells it to check for updates whenever it's launched.

Sites like MacUpdate and VersionTracker are useful allies in ensuring all your software is up to date (as well as in helping you find new applications). If you have a large number of applications for which to manage updates, VersionTracker also offers a subscription service and utility as well as a Dashboard widget to help ensure that your apps are up to date.

While software updates are generally solid, some updates from both Apple and third-party developers have been known to create their own set of problems -- sometimes even removing or altering the functionality of the software. These problem updates are typically pulled from the Internet quickly, often replaced by newer updates that correct the problem.

For these reasons, not installing updates immediately when they are released can be a good habit to get into. It's wise to keep track of new updates as they appear, but try waiting for a day or two to see if any problems are reported on Mac news and information sites such as MacNN, MacDailyNews, Ars Technica's Apple section and Apple's own discussion forums before proceeding with the installation.

When you receive a Software Update notification, you can elect not to install specific updates. In the Software Update pane in System Preferences, you can also disable automatic checking of updates or change the feature to check on a monthly rather than weekly basis. If you disable automatic checking altogether, be sure to run Software Update manually (choose the Software Update command in the Apple menu) on a periodic basis or in response to news that specific updates have been released.

2. Make sure your hard drive is healthy

There was a time (before the release of Mac OS X) when Mac users religiously ran Disk Utility or an alternate hard drive utility at least once a month to verify the integrity of their hard drive directory structures.

A hard drive's directory structures are created when a disk is formatted or partitioned; they're essentially a map of the drive's magnetic platters. They translate the physical sectors that store bits of data on a drive to usable space for files, applications and Mac OS X system components. If they become damaged or corrupted, the Mac can have a tough time locating pieces of files as needed to accomplish tasks like opening files, launching applications and even booting up.

The good news is that technology has come a long way since the days when Disk Utility was a frequent necessity. The default file system for Leopard is Mac OS Extended Journaled, or HFS+J. Journaled file systems keep a transaction log of changes to data on the hard drive. (Microsoft Corp.'s NTFS is another example.) Should the hard drive experience a problem like an unexpected reboot or removal without being ejected properly -- the two most common causes of damage to directory structures -- the file system can rely on the transaction log to repair the damage.

Even so, hard drives can develop some directory corruption over time, particularly if a hard drive is repeatedly unplugged or removed without being properly ejected or if the drive is formatted using an older nonjournaled file system such as the Mac OS or Mac OS Extended file systems, also known as HFS and HFS+, respectively.

So it's still a good idea to use a disk utility occasionally, especially whenever you experience unexplained problems, crashes or failures to open items. If you have drives that aren't journaled, you should still do this on a regular (close to monthly) basis. Journaled drives, however, can be checked less frequently. You can try Disk Utility's Verify Disk and Repair Disk features or a third-party utility such as Micromat's TechTool Pro, Prosoft's Drive Genius, or Alsoft's DiskWarrior, all of which cost around $100.

These tools essentially work by comparing a drive's directory with its actual contents , also called verifying or examining the disk. If problems are found, the utilities can attempt to repair the directory.

The extent to which they are successful depends on the format of the disk, the extent of the damage and the utility being used. In general, third-party utilities tend to be somewhat more successful than Disk Utility in recovering severely damaged directories, though your mileage may vary.

Generally, Disk Utility (found in /Applications/Utilities) is the first stop for checking for hard drive issues because it is freely available and relatively easy to use for identifying and resolving most problems. To verify or repair a drive's directory structures, select the drive from Disk Utility's list box, click the First Aid tab, and click the Verify Disk or Repair Disk button.

When you repair a disk, Disk Utility will first verify the disk and then attempt to repair the directory information if it finds problems.
Verifying the hard drive in Leopard
Verifying the hard drive.
Click to view larger image.

Note: If you are comfortable working from the command line, you can also boot a Mac into single-user mode and use the Unix fsck command, though this is more commonly used as a troubleshooting option if a Mac's hard drive is so corrupted that it can't boot successfully.

The same functionality is available in Disk Utility, which is generally easier and safer for many users, as fsck's options and single-user mode provide unrestricted access to a Mac's file system.

Then there are the physical components to any hard drive. These include the spinning magnetic disks (known as platters) that hold data, the read/write heads that scan and access those platters, the drive motors, the cache RAM chips that speed up data access, and the chips that tell the drive how to function and interact with the other components of a computer. A failure in any of these physical components can lead to problems much more serious than disk directory problems.

Almost all modern hard drives include a technology known as Self Monitoring and Reporting Technology, or SMART. SMART allows hard drives to continuously check, diagnose and report the state of their physical components. While SMART status information won't prevent a hard drive from failing, primarily because such a failure is a physical problem with the hardware rather than corruption of directory data, it can alert you to problems before they become so severe that you can no longer access the hard drive.
SMART status
Good news: The SMART status is verified.

Most hard drive utilities allow you to view a drive's SMART status. In Disk Utility, the SMART status is listed along with general information about a disk at the bottom right of the window. (Note: To view the SMART status of a drive, you need to select the drive itself rather than a volume that exists on the drive.) ISlayer.com's free iStat Pro and iStat Menus show you SMART status and other system information from the Dashboard or the Mac's menu bar.

If a drive's SMART status says Verified, the drive is healthy. If the status is About to Fail or Failed, you should immediately back up all data and replace the drive.

3. Don't overfill your hard drive

Today's Macs serve as a hub for all kinds of digital media content, whether you've produced it yourself, purchased it from the iTunes Store, or ripped it from your CD and DVD collection. All of those videos, photos and songs can fill a Mac's hard drive pretty quickly. Which brings us to another way to keep Leopard running smoothly -- don't overfill a Mac's hard drive.

Like other operating systems, Leopard uses the hard drive to store not only your data, but also various temporary and cache files needed to support the data and run applications properly. It also relies on the hard drive for virtual memory, in which data not in active use gets swapped out of RAM to the hard drive to accommodate active applications. Leopard invisibly performs these functions without any intervention from the user.

However, in order for this to happen, there has to be free space on the hard drive for Leopard to use. If the hard drive is too full, Leopard has to rely on the start-up drive for these purposes, which means the Mac's performance will seriously degrade. In some cases, you may even notice some erratic behavior and application crashes if the hard drive is almost completely full.

That's why being aware of the free space on your hard drive is important in keeping your Mac functioning at its best. A good rule of thumb is to make sure that you have at least 10% of your drive free at any given time. You can see a drive's free space at the bottom of any Finder window for a folder that resides on the drive (or for the drive itself).

If your drive begins to get too full, you have a few options. The simplest solution is to buy an external hard drive. With a laptop, you'll want to move larger or infrequently used files to the external drive; with a desktop system you can simply make it a second hard drive for regular use. You can also replace the internal hard drive of either a desktop or portable Mac with a larger drive.

Finally, you could try to trim the amount of data on your current drive. Disk Inventory X (free) and id-design's WhatSize (shareware, $13) are two helpful tools for discovering just what files are eating up hard drive space and which can be easily moved to a secondary drive or potentially deleted altogether. Prosoft's $99 Drive Genius, which offers several hard drive tools in a single application, now includes a DriveSlim feature that can search for large files, files that have not been accessed recently and duplicate files.

Note: This same rule applies to the embedded version of Mac OS X that powers both the iPhone and the iPod Touch. If you notice erratic behavior on those devices and they are filled to bursting, removing some content may help (though there could be other causes as well).

4. Delete cache files

Many applications rely on cache files to improve performance. The most obvious example is Web browsers, which cache images and other content from Web servers to speed up repeated access to the same files. Leopard itself maintains a series of cache files for improving system performance when using a number of features.

Cache files can present problems if they become corrupted or damaged. The operating system or an application that relies on the cached data may behave erratically or crash because it can't properly read the data in the file -- leading to potentially more corruption if an app crashes while it's writing to the file.

Unlike files in the Unix /tmp directory, cache files aren't cleared when a Mac is rebooted, which means that even when they aren't corrupted, cache files can sit around taking up space on your hard drive long after a given application is deleted. They can also retain settings and private information that you may wish to get rid of. As such, pruning cache files is a prudent choice, particularly if you notice that an application isn't as stable as it used to be.

Cache files exist for both the system (in the /Library/Caches folder at the root level of a start-up drive) and for each user (in the same location inside each user's home folder). Since cache files are not used to store application preferences or general settings, you can safely delete them without losing any data, and they will be regenerated as needed.
Deleting the cache files
Deleting the cache files.

5. Verify and delete preferences files

Another common cause of application crashes and other problems is corrupted preferences files. These are the files that system components and applications use to store settings. In Mac OS X, preferences files are stored as XML property list (.plist) files. You can verify whether a preference file is corrupt by using JNSoftware's Preferential Treatment (donationware), a graphical interface to the plutil command available in Terminal.

Although this tool doesn't know what data should be in a property list file or exactly what the various sections (known as keys) relate to in terms of the settings available to a given application, it can verify whether the data is packaged in the correct format and is readable.

It doesn't always work perfectly, and in some cases, it might report a file damaged when it isn't, but it's pretty good most of the time. By using it to verify your preferences files, you can detect corrupted files and delete them before the problem becomes bigger -- although doing so will result in a loss of settings for the affected application.

One lesser-known feature of Leopard is that it has some built-in capability for responding to corrupted preferences files. If an application crashes repeatedly at launch, Leopard will ask if you want to open the application without using the existing (and potentially damaged) preferences file for it. If you say yes and the application launches and runs cleanly, you can delete the preferences file. If it continues to crash, there's likely another cause.

Although this automates troubleshooting application crashes caused by corrupt preferences files, it does mean that applications have to experience severe enough problems that they can't even launch in order to trigger the feature. Verifying your preferences with Preferential Treatment every couple of months (or more frequently if you are experiencing application crashes) can prevent things from reaching that stage.
6. Verify and repair file permissions

Like all versions of Mac OS X, Leopard is a Unix operating system at heart, which means that every file on your hard drive has permissions that define who can access, change or delete it. In addition to the user accounts you create for yourself and others to log in to your Mac, there are a number of system-user accounts that Leopard relies onto manage everything from the Spotlight search feature to the Installer utility. And, of course, there is the root user, which has complete authority over all user and system files.

Likewise, Leopard relies on a series of system-level groups to manage file permissions for both system and regular user accounts. Many system and application files have specific permissions that ensure the appropriate system processes; system-level accounts can not only access them, but also secure them from intentional or inadvertent access.

However, changes to the permissions of system and application files sometimes do happen -- perhaps by a power user or would-be hacker changing permissions to allow access to certain files, or by application or driver installers that overwrite or modify existing files, or even just by running some poorly designed applications.

If the permissions on these files are altered, the results can range from general erratic behavior to a nonfunctioning application to a Mac becoming vulnerable to network attack.
Verifying file permissions
Verifying file permissions.
Click to view larger image.

To ensure that the permissions on system and application files are set appropriately, run Disk Utility's Verify Disk Permissions feature. This shouldn't affect any user home folders or documents.

This feature isn't entirely perfect. It relies on the contents of the /Library/Receipts folder on the Mac's hard drive, where any installer you run will deposit information about the files it installed or modified, including the permissions for those files at the time of installation. For most people, this can serve as a troubleshooting step rather than a regular maintenance task.

This allows Disk Utility to compare a file's current permissions to what they were originally or to restore the expected permissions. In the majority of cases, there should only be a handful of differences, and resetting or repairing them (by choosing Repair Disk Permissions) can prevent problems.

In some cases, there may be a reason changes have been made -- such as if an application or device driver requires access to some files -- which itself can create problems, though this is generally not an issue for most users. (If you notice that a particular piece of software or device isn't functioning normally after repairing permissions, you might want to check the developer's Web site to see if there are known issues related to specific permission requirements. Typically, reinstalling the affected software will resolve these rare situations.)

7. Test your backups and verify space periodically

One of the most noteworthy new features in Leopard was Time Machine, which makes maintaining backups as easy as connecting an external hard drive or Apple's Time Capsule and performing a couple of clicks. Although Time Machine is generally problem-free, it's a good idea to periodically (once a month is a good rule of thumb) test your Time Machine backups (or any backups). This allows you to be sure that your Mac is backing up properly before an emergency occurs.

On the backup front, there are a couple of other things to keep in mind with Time Machine. First, consider periodically verifying the directory structures and SMART status of the hard drive storing your backups (and repair as needed) for much the same reason as testing the backups themselves -- to make sure they will be available if you ever need them.

Most people probably don't need to do this on a terribly frequent basis, but it can be a good habit to do along with checking your primary hard drive or verifying the backups themselves.

Second, keep tabs on how much space is left on your backup drive. Because Time Machine keeps multiple generations of backups, it is possible to fill a rather large hard drive pretty quickly, especially if you work with a lot of large media files. Time Machine is designed to intelligently prune backups to provide you with a mix of older snapshots and more recent snapshots of your data when the drive grows full. The intent is to preserve the widest time frame possible.

If the drive becomes completely full, intelligently or not, Time Machine removes past generations of backups to make room for new ones (and alerts you to the fact). Keeping tabs on the drive's free space will give you time to deal with the situation -- typically by buying a new Time Machine drive.

Note: One way to conserve space on a Time Machine drive is to exclude Leopard's system files or folders containing large files that change frequently, such as the scratch folders used by many professional media and graphics applications. You can make this adjustment in the Time Machine pane in System Preferences.

8. Defragment your hard drive

One of the long-standing maintenance tasks for computers has always included defragmenting the hard drive. Fragmentation occurs when individual bits of data that make up a file are stored in scattered sectors across the physical platters in a hard drive rather than being stored in sequential sectors. When this happens, the hard drive takes longer to locate and access those files, which can result in significantly decreased performance.

Defragmenting a hard drive improves performance by placing all the bits that make up a file next to each other on the physical drive. Optimizing a hard drive (a phrase typically used interchangeably with defragmenting) organizes similar types of data (such as system files, applications and user documents) sequentially. This can result in increased start-up and application launch times, but most utilities will perform both defragmentation and optimization at once.

Some file systems are much more prone to hard drive fragmentation than others. The Windows FAT system that was introduced in the '80s (and later superseded by FAT32 and then NTFS) was probably the worst offender in terms of fragmentation.

The current Mac OS X Extended file system (and its variations) and Leopard itself do not produce nearly so much fragmentation. In fact, since the release of Mac OS X Panther, Macs rarely divide up the bits that make up a file. If a file is modified and saved, the entire new version of the file will be written as a whole in a series of continuous sectors.

As a result, unless a Mac's hard drive is particularly full and you are working with very large files (such as digital video), you probably don't need to worry about fragmentation. However, defragmenting can improve performance somewhat, and most third-party utilities that defragment or optimize a hard drive will also verify and repair the directory structures as part of the process. (Mac OS X doesn't come with such a utility.)

9. Allow Apple's maintenance scripts to run


Mac OS X includes a series of three maintenance scripts designed to run daily (every night at 3:15 a.m.), weekly (every Saturday at 4:30 a.m.) and monthly (the first of every month at 5:30 a.m.). These scripts perform common maintenance tasks for several of the Unix underpinnings of Mac OS X. While most users won't see any overt problems if these scripts aren't run regularly, they do perform some important functions, mostly related to conserving disk space.

The daily script backs up local directory service information -- in previous versions of Mac OS X, the daily script backed up the entire NetInfo database that contained user and computer-level account information, which has been replaced by a series of flat files in Leopard. It also creates reports on installed network interfaces and free disk space, and compresses the current system.log file (which stores entries for most Mac OS X actions) as an archive, and rotates the current archives.

In addition, the daily script clears the contents of the Unix /tmp directory (this also occurs when you restart a Mac), where many applications and installers store temporary files that do not need to be maintained. This combination of actions frees disk space, provides some backup of critical account data and prevents any problems that might be caused by applications accessing corrupted temporary files.

The weekly script updates the databases for the Unix locate and whatis commands -- used for finding files and for viewing short pieces of data about Unix commands, respectively -- resulting in improved Terminal performance. It also archives any secondary system logs (such as the log files created by the built-in Web server) in much the same way that the daily script archives and rotates the system.log file.

The monthly script runs a user time-accounting script, which compiles information about how much time each user of a Mac has been logged in, and rotates the installer log files.

While these scripts are mostly for housekeeping, they can have an impact on the overall performance of a Mac as well as the amount of free disk space. The rotating of log files can also make it easier to locate log entries if needed. Typically, however, most users won't notice major problems if the scripts don't run.
Have your say
What are your secrets for keeping OS X purring?

The default timing of these scripts was likely aimed at running them without any affecting performance. In earlier versions of Mac OS X, if the Mac was asleep or turned off during the scheduled runtimes, the scripts wouldn't run. In Leopard, however, the Mac should run the scripts on waking or starting up, so there is less need to run these scripts manually than there was a few years ago.

Still, if you notice disk space decline, performance problems or general flakiness, running the scripts manually or adjusting the time may be helpful. The scripts can be run manually using one of a number of Mac maintenance utilities including OnyX (free), Cocktail ($15, free trial), Macaroni ($10, free trial), or MainMenu (free) -- all of which also enable you to perform a number of other tasks described in this article.

Another related tip if you are short of disk space is to periodically delete some of the archived log files. Unless you have a need to maintain every tidbit of information about a computer's activity, you can probably delete months-old log files without any worries. Log files are useful for troubleshooting problems and can also be used to investigate activity that has occurred on a Mac. However, if you've never looked at a log file, aren't experiencing any problems, and the file is months old, chances are you aren't ever going to need to look at it. Given that some log files can get quite big, this can be one way to put your hard drive on a diet.

10. Restart periodically

One of the simplest ways to keep your Mac running well is to periodically restart it. Although there is no need to shut down Mac OS X on a nightly basis (many users report running Macs for months on end without restarting), restarting a Mac every couple weeks can be helpful both in a general sense and if you are experiencing any problems.

When a Mac boots, several different routines are called as part of the start-up sequence, including a basic file-system check (the Unix fsck tool) that verifies some of the directory structures on the hard drive and a clearing of any temporary files stored in the Unix /tmp directory. Rebooting also causes the Mac to run through its power on hardware tests and reinitialize its connection to any built-in hardware.
More great Leopard tips

* Make Leopard leap: Time-saving tips for OS X 10.5
* Leopard tamers: 9 terrific interface tweaks
* Secrets of the Mac trackpad, from iBook to MacBook Air
* Opinion: The top 25 overlooked and underrated features in Leopard
* Get Leopard and Windows to play nice

Ryan Faas is a frequent Computerworld contributor specializing in Mac and multiplatform network issues. Find more about him at RyanFaas.com.
 
Time Machine's task is to make your backup data available to retrieve, and includes the capability to retrieve individual files that may have been deleted months ago, if your Time Machine backup extends that far back.
Testing (in my opinion) would involve retrieving some random older file. If a few files are good (open correctly with the relevant app), then you can expect that the rest of your backup is OK.
Other backup methods may create a bootable backup, so one test might be to try booting from that bootable backup. Time Machine does not need that test, as it doesn't create a bootable backup.
 
Back
Top