Show HN: Clean Your Mac with a Script (github.com)
I wanted to clean old temporary files and caches from my macOS with a script instead of using a shady paid app, so I created a simple script for that.
Pull requests are very welcome for other unused files to clean up storage space!
20 comments
[ 4.1 ms ] story [ 54.7 ms ] thread(in all seriousness folks, if you're gonna show HN, spend some time on your README, docs, etc).
The main issue I'm finding is that `find` seems extremely slow at deleting things.
The script is clean and straightforward.
Why is this written for bash, which isn't getting recent changes?
Or, if the person is like me, they're more comfortable in Bash after years of it being the default. Hacking around in a less-familiar shell seems like a bad idea if it's optional when deleting data, regardless of what's currently the default. (I realize that zsh can execute commands with Bash syntax, that's not my point.)
When this is done, it will run in all the shells, because the script becomes POSIX-compliant.
Wasn't a previous argument that legacy Macs should remain supported if possible?
smh.
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.
The ability to do that is actually quite powerful as both disaster recovery and getting new hardware - it is in my mind so much cleaner to just install everything again. The built in migration tools have always done too little or too much for my taste. Dotfiles feel just right.
Funny enough hkdobrev introduced me to this philosophy almost 15years ago which I still use to this day and try to spread wherever I am. Thank you!
[1] https://github.com/webpro/awesome-dotfiles
https://applejack.sourceforge.io
Nowadays, Onyx (also free) tends to do the trick:
https://www.titanium-software.fr/en/onyx.html
Does this script close any gaps left by Onyx's MAINTENANCE routines?
But hey, maybe my apps will be snappier?
If my 10 year old macbook doesn't see much improvement, I don't think a newer machine will see it either.