OS X System Cache Cleaning Script
As part of its normal operation, OS X creates a number of cache files
that allow it to speed up its operations. Like any files, these
cache files can become corrupted, fragmented, or otherwise
damaged. This can cause the system to slow down, crash, or behave
erratically.
To prevent such problems, I developed the following
script to delete the system cache files on the computer each night and
force a reboot to maintain the system’s integrity (since deleting a
cache file the OS is using would be “a bad
thing”).
While I’ve tested this script on Mac OS X 10.3.x and
10.4 and believe that it functions as designed, I can’t promise that it
will work on earlier or later OS X releases and provide no warranty or
support. As with all my scripts, this one is provided “as
is”. If you are able to make use of it and derive value from
it, great! If not, you assume all responsibility and liability for
what happens to your system if you choose to use or modify this
script.
This script can be executed from the command line or via a
cron task.