Clean system cache at startup

May 17, '02 08:36:58AM

Contributed by: robg

Reader Dan K. emailed me the following script which clears out the cache entries on your machine. This includes the caches in System, Users, and Library, along with the Internet Explorer cache.

Dan also explains how to add the script to an existing startup item so that it runs each time you reboot.

Read the rest of the article for the script...

This mini-script can be appended to the StartupItem "Cleanup" located in
/System -> Library -> StartupItems -> Cleanup -> Cleanup. I edited this file in pico with administrative rights via "sudo -s". Try it out!

## SUBSTITUTE YOUR USERNAME FOR user_name !!!

clear
echo ""
echo ""

# scrub the system-level cache files

ConsoleMessage "Clearing Cache"
echo "Cleaning out Cache files..."
cd /System/Library/Caches/ ; rm -f -PR *
cd /Users/user_name/Library/Caches/ ; rm -f -PR *
cd /Library/Caches/ ; rm -f -PR *

# privacy freaks REJOICE

ConsoleMessage "Clearing Internet Explorer Temp Files"
echo "Erasing IE fingerprints..."
cd /Users/user_name/Library/Preferences/Explorer/
rm -P History.html
rm -P "Download Cache"
[Editor's note: I have not tried this script myself, primarily because I (a) don't use IE and (b) hardly ever reboot! I would also recommend that you backup the Cleanup script before you start. If anyone tries this out, feel free to post your experiences...]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020517083658759