Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Modifying apple files considered harmful' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Modifying apple files considered harmful
Authored by: jpbjpbjpb on May 18, '02 10:36:56PM

Don't modify the Cleanup Script - things in /System are NOT guaranteed to not be deleted or changed by Software Update.

Instead, make your own startup item in /Library/StartupItems

sudo mkdir /Library/StartupItems/CacheCleaner

You may have to create /Library/StartupItems - I don't remember if OS X ships with an empty one by default or not. If you do have to create it, remember that there is not a space between Startup and Items

Create /Library/StartupItems/CacheCleaner/CacheCleaner with the following contents:

#!/bin/sh

. /etc/rc.common

##
# Start mail server
##

ConsoleMessage "Cleaning System Cache Files"
rm -fr /System/Library/Caches/*
rm -fr /Library/Caches/*

Don't forget to chmod 755 /Library/StartupItems/CacheCleaner/CacheCleaner or the startup item won't load.

Now create /Library/StartupItems/CacheCleaner/StartupParameters.plist with the following contents:


{
Description = "Cache Cleaner";
Provides = ("CleanCache");
Requires = ("Cleanup");
Uses = ("Cleanup");
Preference = "None";
OrderPreference = "Early";
Messages =
{
start = "Cleaning System Cache Files";
stop = "Cleaning System Cache Files";
};
}


This way you don't have to worry about system updates (like Jaguar) trashing your startup item. The line Requires = ("Cleanup"); will tell OS X to run your startup item some time after the standard Cleanup startup item.

Now to clean your personal caches, you're better off using an applescript that launches during login.

Open Script Editor, and put the following lines into a new script:


do shell script "rm -rf ~/Library/Preferences/Explorer/Download*Cache"
do shell script "rm -rf ~/Library/Caches/*"
-- Uncomment the next line if you want to nuke your IE History as well
-- do shell script "rm -rf ~/Library/Preferences/Explorer/History.html"

Save the script somewhere, then go into the Login pane of System Preferences and add the new script to your login items.

jpb

[ Reply to This | # ]