Remix.run Logo
duskwuff 12 hours ago

1) Deleting individual files from ~/Library/Caches based only on their mtime is not safe - especially since some files (like files extracted from archives or downloaded over HTTP) may be stored with an mtime matching the source data. At a minimum, you really need to base this on the last access time; even then, I would be hesitant to delete individual files from an application's cache while leaving others.

2) /tmp and /var/tmp are cleared on reboot. Clearing them manually is probably not worth the hassle.

3) A week is way too short as a default for DAYS_TO_KEEP. A more appropriate value might be on the order of 30 - 90 days.

4) brew doctor is purely a diagnostic tool; it doesn't perform any maintenance operations. It doesn't belong in this script.

antihero 3 hours ago | parent [-]

Why is a week way too short? Surely anything in Caches should be effectively ephemeral. If you rm -rf the entire Caches/*, all that should happen is some apps might be a little slower for a bit?