There are many times when in our articles we will mention "General Maintenance" as part of a troubleshooting routine. If you are having software issues, either with third-party applications or the Mac OS itself, giving the computer a virtual scrub-down will many times help, or at least give you a cleaner slate upon which to do more in-depth troubleshooting.
OS X contains a number of different settings and temporary items, both in software and hardware, that can influence how the system and applications are running. On the hardware side there are the system's PRAM and SMC/PMU settings, in addition to the boot drive's volume and partition table structures. On the software side there are system and user caches, along with file permissions. While you might also look at settings files like user preferences, tackling those is not part of general maintenance and instead is more in the realm of troubleshooting specific system features or applications.
Quick Addendum: Keep in mind that while general maintenance is a procedure that can be run periodically and will not hurt anything to do so, it is not necessary to run it on a regular basis. If you are experiencing slow-downs or other odd behavior then it is a recommended and sometimes necessary step, which is why we mention it in our articles here; however, you do not need to conform to a maintenance schedule.
With this in mind, the following procedure will cover the general maintenance of the system:
1. Get Prepared
First download a reputable cleaning and maintenance utility. Make sure it is built for and tested on your version of OS X, since some may have multiple versions available for different major releases of the Mac OS. Some recommendations are:
- MacKeeper (though this utility has a poor track record in the Mac community)
- [Snow] Leopard Cache Cleaner
With one of these applications installed, get your system restore discs or some other alternative boot volume (ie, a clone, a retail OS X installation DVD, or even another Mac with a FireWire cable), and proceed with the maintenance.
A popular maintenance tool that is a good one-stop shop for running periodic maintenance routines on a Mac is AppleJack, which runs in single-user mode and therefore has far more access to the system for cleaning purposes than other programs. However, while this utility lumps a number of maintenance routines together, you will need to still perform hardware resets separately.
2. Repair the boot volume
The first approach should be with the hardware, so boot to your alternative boot volume. If you have used the OS X installation DVD, when the installer loads choose your language and then open Disk Utility from the Utilities menu. Run a disk verification followed by a repair if needed, but do not use this to run a permissions fix (do that when booted from the internal boot volume). Note that while Disk Utility is adequate for most purposes, if you have a third-party disk utility with a boot disk (such as Drive Genius, Disk Tools Pro, DiskWarrior, or Tech Tool Pro) then you can use that as well to verify the volume structure, partition tables, do a surface scan, and perform other more advanced testing.
3. Reset the SMC/PMU
After the hard drive has checked out, reset the SMC or PMU. Keep in mind that this is an optional step, and is only really needed if you are experiencing problems with items like fans, sleep modes, inability to start up on batteries, and other power-related features.
Most Intel-based Macs will just require you to shut down, unplug the system, and then press and hold the power button for a few seconds to reset it; however, the procedure for this can be machine-specific. On older PowerPC Macs you may need to press a button on the motherboard to reset the PMU. Here are some resources for how to do this:
4. Reset the PRAM
With the SMC/PMU reset, next reset the PRAM by rebooting the system and immediately holding down the Option-Command-P-R keys all at once when the boot chimes sound. The system will continually reset as long as you hold these keys down, and let it cycle a few times before releasing the keys and allowing it to boot normally.
5. Boot to Safe Mode
When you do release the keys in the PRAM reset, immediately press and hold the Shift key so you the system will boot into Safe Mode. If you miss this and the system boots normally, just reboot it again while holding the Shift key. This will load into Safe mode which will ensure minimal interference from non-essential kernel extensions and system services. It will also run a few maintenance routines and again check the hard drive for volume structure errors (though doing this when booted to another volume is more thorough).
6. Fix Permissions
When in Safe Mode, open Disk Utility on the boot drive and run a permissions fix. Do not run it from another OS installation (even the OS installation DVD) since this may not properly read the permissions database which includes the installer receipts on the boot drive. Many maintenance utilities such as OnyX will have a permissions fixing routine, which can be used instead of Disk Utility with the same results. The key is to run the permissions fix when booted off the default boot volume, and not from an alternative boot drive. If your maintenance utility does not have a permissions fix feature, then launch Disk Utility and run it from there.
7. Run the cleaning application
After a full permissions fix, open your cleaning utility and run any maintenance-related scripts. These may depend on the program, but overall you should try to run the following (available in OnyX):
- Clear the dyld cache
- Clear the font, boot, and kernel caches
- Clear all user-related caches
- Run Daily, Weekly, and Monthly scripts
In addition to these tasks, you might consider rebuilding the launch services (file/application association), as well as removing spotlight indexes, audio and media components, and rebuilding the directory services.
After the maintenance routines have been run, reboot the system twice. The first time you reboot the system may run a little slow while the boot caches and other caches are refilled. Rebooting a second time should have things running normally again.