10 Essential Tasks to Keep Leopard Purring

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.

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.

Ryan Faas is a frequent Computerworld contributor specializing in Mac and multiplatform network issues. Find more about him at RyanFaas.com.

Subscribe to the Best of TechHive Newsletter