First read A simple task for regular Mac maintenance to get up to speed. If you follow the steps in that article but you find that your mac is still pokey then there are other parts of your system that can be cleaned up. However, the steps to clean up these deeper areas of the system are not for beginners or for people who aren't experienced with the UNIX command line. If either of these describe you, then you should print this article out and have someone who is more knowledgeable and skilled in the command line take care of it for you.
Using Terminal or booting up in Single User Mode is not for the faint of heart. DO NOT ATTEMPT these steps unless you know exactly what you're doing! Even the slightest typo can risk erasing your hard drive!
***WARNING - unix commands below. For expert use only. Do not proceed unless you know what you're doing. You've been warned***
You're going to start your computer up in Single User Mode to do this.
After it boots in single user mode and you're given the prompt, run:
When it finishes scanning and repairing any problems it finds, then run:
/sbin/mount -uw / (Don't forget the trailing slash and the space before it " /")
Now get ready to get to work! As a best practice, I ALWAYS "cd" to and then "ls -la" the contents of any folder I'm about to clear out. To keep things simple here, I'm just going to list the commands as if you were running them all from / (root).
rm -R /tmp/*
rm -R /var/tmp/*
rm /var/spool/cups/c* Notice I didn't use the -R switch. If you're running OSX 10.5, you may get an error saying that "cache is a directory". That cache folder is new in 10.5 see next...
rm -R /var/spool/cups/tmp/* You can take a look inside the cache and the tmp folders within /var/spool/cups/ and delete the CONTENTS if there are any but never delete the cache and tmp folders themselves.
rm /var/spool/cups/d* the CUPS engine may possibly create some files that may be named something like "d0012-4134" You only need to run this command if you see any of those "d" files listed.
*10.5 only* rm -R /var/folders/* This folder is new to 10.5 and does not exist in previous versions of OS X. It is filled with a bunch of folders with weird names. If you run this command and there are some files/folders that didn't get erased, then you'll have to delete those items by name.
rm -R /library/caches/*
reboot yes, that's the command to restart your computer
When your computer reboots this first time, it may take slightly longer than usual because it has to recreate some of the files we deleted. That's ok, that's what it is supposed to do. Subsequent reboots should be faster and you should notice a much faster system.
If your system is still slow even after all this, then you should have a Mac expert (such as HappyMac) take an in-depth look at your computer to see if there are other factors.