TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Clean Your Mac with a Script

44 点作者 hkdobrev6 个月前
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.<p>Pull requests are very welcome for other unused files to clean up storage space!

10 条评论

duskwuff6 个月前
1) Deleting individual files from ~&#x2F;Library&#x2F;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&#x27;s cache while leaving others.<p>2) &#x2F;tmp and &#x2F;var&#x2F;tmp are cleared on reboot. Clearing them manually is probably not worth the hassle.<p>3) A week is <i>way</i> too short as a default for DAYS_TO_KEEP. A more appropriate value might be on the order of 30 - 90 days.<p>4) brew doctor is purely a diagnostic tool; it doesn&#x27;t perform any maintenance operations. It doesn&#x27;t belong in this script.
评论 #42255104 未加载
cpursley6 个月前
Yep, df gonna run this rando script with such a detailed and inspiring README...<p>(in all seriousness folks, if you&#x27;re gonna show HN, spend some time on your README, docs, etc).
评论 #42252128 未加载
seer6 个月前
I’ve found that with a good dotfiles[1] setup + cloud storage, it is better to just reset the whole system and re-install whatever is needed.<p>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.<p>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!<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;webpro&#x2F;awesome-dotfiles">https:&#x2F;&#x2F;github.com&#x2F;webpro&#x2F;awesome-dotfiles</a>
评论 #42252839 未加载
ryandrake6 个月前
It would be really great if operating systems (and applications) didn&#x27;t have to be constantly cleaned up in the first place. Way too much software uses the user&#x27;s filesystem as their personal dumping ground for crap. Crap that they leave around when not running and crap that they leave behind when they&#x27;re uninstalled. My ~&#x2F;Library directory is currently 47G(!!) and it&#x27;s mostly a bunch of shit that I have no idea whether I need or not. As the user, I should be the one who decides what to put on my filesystem, not some application developer. We&#x27;ve completely lost control of our own filesystems.
domoregood6 个月前
Loved AppleJack (free), back when it worked:<p><a href="https:&#x2F;&#x2F;applejack.sourceforge.io" rel="nofollow">https:&#x2F;&#x2F;applejack.sourceforge.io</a><p>Nowadays, Onyx (also free) tends to do the trick:<p><a href="https:&#x2F;&#x2F;www.titanium-software.fr&#x2F;en&#x2F;onyx.html" rel="nofollow">https:&#x2F;&#x2F;www.titanium-software.fr&#x2F;en&#x2F;onyx.html</a><p>Does this script close any gaps left by Onyx&#x27;s MAINTENANCE routines?
CharlesW6 个月前
I&#x27;m sure this script is wonderful, but it&#x27;s not a replacement for the apparent target of the author&#x27;s disparagement, created by the legit folks at MacPaw (established 2008). A good place to start is the free Unarchiver, which can extract anything you can throw at it. <a href="https:&#x2F;&#x2F;macpaw.com&#x2F;the-unarchiver" rel="nofollow">https:&#x2F;&#x2F;macpaw.com&#x2F;the-unarchiver</a>
chasil6 个月前
Isn&#x27;t zsh the current #!&#x2F;bin&#x2F;sh on MacOS?<p>Why is this written for bash, which isn&#x27;t getting recent changes?
评论 #42252280 未加载
Jiahang6 个月前
i use this one <a href="https:&#x2F;&#x2F;github.com&#x2F;Tencent&#x2F;lemon-cleaner">https:&#x2F;&#x2F;github.com&#x2F;Tencent&#x2F;lemon-cleaner</a>
rgbjoy6 个月前
Try adding a way more detailed readme.
givemeethekeys6 个月前
Review: - It took a while to run on my old Macbook. 30 minutes or so. - Mac still seems to boot up slow. I don&#x27;t really notice the performance improvement. - &quot;System Data&quot; still takes up an insane amount of my disk space.<p>But hey, maybe my apps will be snappier?<p>If my 10 year old macbook doesn&#x27;t see much improvement, I don&#x27;t think a newer machine will see it either.