Eight simple steps you can take now to keep your Mac from falling apart

Jan 23, 2006 09:41 GMT  ·  By

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. 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.

5. Prebind

Why: Prebinding allows applications to launch more quickly. However, when prebinding information becomes outdated, launch times increase.

When: Users of OS X 10.2 and earlier should prebind at least monthly - users who install and remove a lot of applications should prebind more often.

Who: Anyone running OS X 10.2 or earlier.

Prebinding is a process through which OS X figures out what code is used by an application before it runs, greatly reducing the application's launch times. In early releases of OS X, prebinding information could become out-of-date, leading to slow-launching applications. If you're running a pre-10.3 version of OS X, use one of the tools mentioned in "Part I" to update your prebinding information. Or do it yourself in the Terminal: Open a new window, type ?sudo update_prebinding -root /" , and enter your admin password when prompted. You may want to do this at the end of a workday - the process can take as long as an hour, depending on how many applications are installed.

In OS X 10.3 and later, the system automatically updates prebinding information whenever you use Apple's installer program to install a program on the boot volume (the "optimizing" step you see during the install process). For programs that are either drag-installed or installed on other volumes, the system automatically runs a tool called fix_prebinding when it detects an application with outdated prebinding information. The preceding command works on 10.3 systems, but it shouldn't be necessary.

Use the Console to check the output from OS X's built-in daily, weekly and monthly maintenance scripts.

DiskUtility checks a Mac's SMART indicators. The text at the bottom right indicates that the drive's health is good, with no signs of impending failure.

OnyX has many maintenance features wrapped up in a tidy interface. You can also use it to force-empty the Trash, which is useful for removing the occasional stubborn file stuck in your Trash.

Using SMARTReporter, you can have your machine tell you via e-mail, application execution, or pop-up alert whenever a drive's SMART status indicator shows a potential problem.

6. Automate Your Maintenance

Why: OS X comes with a set of UNIX scripts that run automatically. They delete and archive unnecessary data created through normal use of your machine.

When: You don't have to lift a finger - the scripts run daily, weekly, and monthly, as long as your machine is awake at their scheduled run times.

Who: Heavy users of the command line.

OS X is designed to make basic maintenance tasks invisible to you. The operating system regularly cleans up the little files that can clog your machine - from system logs to FTP logs to firewall logs. But there's a catch. OS X's cleanup scripts are set to run at specific times. The daily script runs at 3:15 a.m., the weekly script runs at 4:30 a.m. on Saturdays, and the monthly script runs at 5:30 a.m. on the first day of the month. Apple probably chose these times because you're not likely to be using your machine during the sleeping hours, so you probably won't be bothered by the CPU draw or the drive noise. Unfortunately, those times are also when most of our machines are powered off or sleeping, so the scripts can't execute.

Most people won't see problems if these scripts don't run regularly, but a few will. To find out if you're one of them, take a closer look at each script's overview below.

The daily script cleans up the tmp directory, where many programs and installers store files that aren't permanently required. iChat, for instance, keeps copies of images you've sent in the tmp folder. (Your machine empties this folder when you restart.)

However, the daily script also backs up your NetInfo database, an essential file with information on your users, services, and devices. If you don't regularly back up this file in some other way, I suggest running the daily script. (Note that recovering this file from a backup is very complicated.)

The daily script also creates a network-interface status report and a free-disk-space report, and rotates the system.log files by creating multiple compressed backup copies.

The weekly script updates the locate and whatis databases (two files that are very useful when you spend a lot of time in Terminal); archives older secondary system logs, such as FTP; and archives Web-server logs. It also restarts your Web server.

The monthly script runs a user time-accounting script (not much to it when you're the only user on your machine) and rotates installer log files.

You can look for reported errors in the output of these scripts by opening the Console program (Applications: Utilities), clicking on the /var/log line in the Logs column (click on the Logs button in the toolbar if you can't see this column), and then selecting daily.out, weekly.out, or monthly.out. The contents of the file display to the right.

7. Keep Hard Drives Healthy

Why: An unhealthy hard drive is a nightmare. SMART (Self-Monitoring Analysis and Reporting Technology) lets you perform a routine checkup that identifies potential drive failures before they happen, so you have time to update backups and look for replacement drives.

When: You (or an automated application) should check SMART indicators daily.

Who: Everyone.

The hard drive or drives inside your Mac are critically important - if the hard drive fails, the Mac won't boot, and you could lose all your files. While there's nothing you can do to physically maintain your drives, there are some tools that sniff out disk weaknesses, and there are a couple of ways to recover data when you do have trouble.

The SMART hard drives in newer Macs diagnose their own health, and they note any problems found with internal drives on an IDE/ATA or SATAbus.

There are two ways to check the status of your Mac's SMART indicators. If you're using the machine locally, launch Disk Utility (Applications: Utilities) and click on the top-level indicator for your drive in the left-hand column. In the bottom of the window, you'll see the words SMART status, and next to that, you'll see the word verified. If you don't see SMART status, your Mac doesn't have the technology. If you see the phrase but it's not accompanied by verified, you should back up your hard drive and then replace it - it will likely experience a failure soon.

If you prefer to use Terminal, or if you connect remotely to Macs - for instance, if you have a Mac in your home that you're using as a server - you can also check the status of the drives from Terminal. In Terminal, type "diskutil info disk0 | grep SMART", assuming that the Mac has only one hard drive. If the Mac has more than one hard drive, type diskutil list to see which drive numbers are assigned to each drive, and then repeat the first command with the proper number.

Manually checking SMART indicators gets old fast. If you're comfortable in the command line, you can add a new cron task that executes this command on a regular basis and writes the output to a text file; you can also create an AppleScript that displays a dialog box and then set the AppleScript to run at login each day. Or you could let a third-party application, such as Alsoft DiskWarrior , Micromat' TechTool Pro 4, or Julian Mayer free SMARTReporter, inspect the drives and alert you if there's an error.

Advanced Maintenance and Repair SMART indicators don't catch everything. Despite your best efforts, you might power up your machine one day and see the dreaded blinking question mark.

Your first step should be to boot from the OS X Install CDs. Next, select Open Disk Utility from the Installer menu (next to the Apple menu). If your boot drive shows up in the left-side drive list, select it, and click on Repair Disk-then sit back and cross your fingers. Disk Utility may be able to repair the disk; if it does, restart and hope the drive works as usual. Then back up important files and consider investing in a new drive.

If Disk Utility can't repair the drive, it's time for DiskWarrior or TechTool Pro 4. DiskWarrior is primarily a directory-repair tool. Its directory-rebuilding feature has returned seemingly dead drives to the land of the living. TechTool Pro also recovers data from dead drives, through a different mechanism. In addition, it can monitor and test a number of other aspects of your system, such as CPU, memory, and power supply. Both are capable tools; which one to use is really a matter of personal preference.

If you can't make the drive work with either of these programs, it has probably suffered a physical failure of some sort. If you're willing to dole out serious dough, companies like DriveSavers Data Recovery can often recover data from even badly damaged drives.

8. Construct a Maintenance Toolbox

Why: Maintaining your Mac doesn't have to be a burden. There's software that can handle it with ease, and some programs even throw in additional system-tweaking features.

When: There's no sense in waiting to download helper applications.

Who: Everyone. Mac users should have at least three utilities: OnyX, SMARTReporter, and DiskWarrior.

For general system maintenance, Titanium Software's OnyX is tough to beat. It's free, it has a clean interface, and its help system is easy to understand. OnyX's features go well beyond basic maintenance: the program lets you erase caches, logs, browser cookies, and even Safari's cached bookmark icons with a few mouse clicks. Throw in the ability to run a Terminal command, browse log files, and view UNIX manual (man) pages, and you've got a maintenance winner.

Julian Mayer's SMARTReporter checks SMART status indicators. While many programs can do this (including Apple's Disk Utility), I prefer SMARTReporter's reporting capabilities. With its intuitive interface, you'll have your drives set up for regular monitoring in no time. You specify the testing interval and the actions to take if a test fails. You can even control SMARTReporter's appearance in your menu bar - a solid green or red disk icon, or just a small green or red dot that indicates the status of the most recent test.

When your hard drive appears to be dead, you need a drive-repair utility. DiskWarrior's ability to resuscitate drives is unmatched. Using a proprietary and patented technique, DiskWarrior builds a new directory for your drive. Once this new directory is built, DiskWarrior lets you mount it as a new hard drive, so you can check it for errors and even copy files off of it. If everything looks good, DiskWarrior then writes its new directory onto your drive. DiskWarrior can't save you from hardware failures that render the drive unusable, but for nearly everything else, it's an invaluable data-saving tool.

The Last Word (Really!)

You've always known that Macs are superior, and this superiority extends to ease of maintenance. With simple housework - checking a few things like permissions, cache and log files, and your drive's SMART status - you can prevent your Mac from falling into disrepair.