Mac Os X Library Caches

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

How to clear cache files on Mac with a single click of a button. Instead of searching all over your Mac to find and remove cache files yourself, you can clear user caches on a Mac using CleanMyMac X. It makes removing cache files as easy as can be. To get rid of cache files with CleanMyMac X: Download CleanMyMac X (free) and launch it. 2016-1-18  Empty Caches Keyboard Shortcut for Safari in Mac OS X: Command+Option+E Once you have enabled the Develop menu, you will also gain access to a keystroke shortcut for clearing caches in Safari using Command+Option+E, which offers a faster method of access for users who need to access the feature often without having to pull down the menu every time. Caches can hold data that is also stored elsewhere on your Mac, leading to duplication. It stores technical data when a browser or app is used, or a system operation is carried out. The cache has the ability to remember a previous function, meaning that the next time it is required it can be repeated must faster. Learn how to clear cache on Mac OS X. Delete your browser cache (Safari and Google Chrome), System and User cache instantly. Now, type /Library/Caches and hit Enter. A new window with all the information of the data used will get open up. You can choose after looking up the dates, sizes, or types of data which you want to delete and which.

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

Google hosts Apple lets you boot from a special partition on your startup drive into the Recovery mode., and then after restarting into macOS, try to copy the library.

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.

Mac

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.

Disk Utility

jpb