OS X has its own built-in utility which automatically runs maintenance scripts (also know as cron jobs) between 03:15 and 05:00 each day. These maintenance tasks are quite basic and can only run when the computer is on. There are several free applications available which enable you to manually run system maintenance tasks. I've outlined some of the popular ones below:
1. OnyX
OnyX is an excellent maintenance and optimisation utility no Mac user should be without. In addition to running maintenance scripts to keep your system running smoothly, you can also delete temporary files such as internet and application caches that have built up over time.
Overview: http://www.titanium.free.fr/pgs2/english/onyx.html
Download: http://www.titanium.free.fr/pgs2/english/download.html
2. sterMachine
sterMachine is a similar application to OnyX, but it isn't as user friendly. Among other things, you can run maintenance tasks, repair disk permissions and delete temp files.
http://www.jaanpatterson.com/stermachine.html
3. MacJanitor
A popular utility designed to run the system's daily, weekly and monthly cron jobs.
http://personalpages.tds.net/~brian_hill/macjanitor.html