如何清除 Mac 上的应用程序缓存
How to clear the application cache on your Mac
清除应用程序缓存并不一定能让您的 Mac 运行得更快。
您的 Mac 应用程序通常会存储称为缓存的临时文件,以改善用户体验。这是大多数开发人员推荐的最佳实践,以防止应用程序在您每次使用时创建或重新下载相同的文件。应用程序缓存包括图像预览、下载内容和其他数据等临时文件,可帮助应用程序快速启动并提供内容而无需额外处理。
例如,当您访问不同的网站时,Google Chrome 会构建其应用程序缓存。它会缓存部分网页(例如图像),这有助于加快您下次访问同一网站时的加载时间。然而,不检查应用程序缓存的问题是,即使应用程序不再需要缓存的文件,它也可能继续占用存储空间。
尽管您的 Mac 可能会管理这些临时文件,但无法保证此过程何时发生。此外,有问题的应用程序缓存可能会导致故障,例如显示过时或不准确的内容。了解如何清除 Mac 上的应用程序缓存可以帮助解决因缓存过时而引起的问题,或回收因缓存膨胀而浪费的存储空间。
某些 Mac 应用程序允许从应用程序本身内部清除应用程序缓存。例如,Safari 和 Apple Music 在其设置菜单中包含清除应用程序缓存的选项。然而,并非所有 Mac 应用程序都是如此。您需要手动找到它们的缓存才能删除它们。
您的 Mac 通常将应用程序缓存存储在 ~/library/caches 中。由于该库被视为隐藏目录,因此您的 Mac 可能不会轻易在 Finder 中显示它。要查看库文件夹:Finder > command + shift + H > command + J > 选中“显示库文件夹”。进入库文件夹后,按 command + J > 选中“计算所有大小”以在文件夹名称旁边显示文件夹大小。
在缓存文件夹中,查找要清除的应用程序缓存。您可以通过文件夹名称和前缀来区分第三方应用程序和第一方 Apple 应用程序。第一方 Apple 应用程序在其捆绑包标识符中使用“com.apple”前缀,而第三方应用程序则不然。打开有问题的应用程序文件夹并删除其中的所有内容以清除其应用程序缓存。如果缓存文件夹中不存在应用程序缓存,您可以在 ~/library/containers 中查找它。容器文件夹包含在沙箱中运行的应用程序,因此它们的缓存也是隔离的。无论您的应用程序缓存位于缓存还是容器中,您都需要应用相同的原则来查找和删除它们。
值得注意的是,清除应用程序缓存并不一定会提高应用程序性能,除非您的 Mac 存储空间已经不足。但是,删除应用程序缓存可以帮助回收存储空间,有时甚至可以解决应用程序故障。当您在清除缓存后启动应用程序时,您可能会注意到该应用程序需要更长的时间才能启动,并且使用它可能会感觉缓慢。发生这种情况是因为应用程序必须重新重建其缓存。但是,一旦此过程完成,您的应用程序应该会感觉流畅且易于使用。
不建议不加区别地清除应用程序缓存或构建涉及应用程序缓存的维护例程。您的 Mac 应用程序依靠缓存来确保流畅的用户体验。仅当您发现应用程序未按预期运行或应用程序占用过多存储空间时,才应清除应用程序缓存。否则,最好不要理会应用程序缓存,让您的 Mac 自行管理。
原文(English)
Clearing app caches don’t necessarily make your Mac run faster.
Your Mac applications often store temporary files, called caches, to improve user experience. This is a recommended best practice that most developers follow to prevent apps from creating or redownloading the same files each time you use them. App caches include temporary files like image previews, downloaded content and other data that help apps launch quickly and serve content without additional processing.
For example, Google Chrome builds its app cache as you visit different websites. It caches parts of webpages, like images, which helps speed up load times when you visit the same website next time. However, the problem with leaving application caches unchecked is that it could continue taking up storage space even when an application no longer requires the cached files.
Although your Mac may manage these temporary files, there's no guarantee when this process occurs. Moreover, problematic app caches can contribute to glitches, like displaying outdated or inaccurate content. Knowing how to clear app caches on your Mac can help resolve issues arising from an outdated cache or reclaim storage space wasted on bloating caches.
Some Mac applications allow clearing app caches from within the app itself. For example, Safari and Apple Music include the options to clear app caches in their settings menu. However, this is not the case for every Mac app out there; you'll need to manually find their caches to delete them.
Your Mac typically stores application caches in ~/library/caches. Since the library is treated as a hidden directory, your Mac may not readily reveal it in the Finder. To view the library folder: Finder > command + shift + H > command + J > check "show Library Folder." Once in the library folder, press command + J > check "Calculate all sizes" to display folder sizes alongside folder names.
In the caches folder, look for the application cache you want to clear. You can distinguish third-party apps from first-party Apple apps from the folder names and prefixes. First-party Apple apps use the "com.apple" prefix in their bundle identifier, while third-party apps don't. Open the application folder in question and delete everything inside to clear its app cache. If an app cache doesn't exist in the caches folder, you can look for it in ~/library/containers. The containers folder includes apps that run in a sandbox, so their cache is also isolated. Whether your app caches are in caches or containers, you'll need to apply the same principle for finding and deleting them.
It's worth understanding that clearing app caches doesn't necessarily improve application performance unless your Mac is already running short on storage space. However, deleting app caches can help reclaim storage space and sometimes even resolve app glitches. When you launch an app after clearing its cache, you might notice the app taking longer to launch, and using it might feel sluggish. This happens because the app has to rebuild its cache all over again. However, once this process is complete, your app should feel smooth and snappy to use.
It is not recommended to indiscriminately clear app caches or build a maintenance routine that involves one. Your Mac apps rely on caches to ensure a smooth user experience. You should only ever clear app caches if you notice the app not behaving as expected or if an app is taking up too much storage space. Otherwise, it's best to leave app caches alone and let your Mac manage it at its discretion.
本文为自动翻译,可能存在偏差,请以原文为准。发布于 2026-11-16 09:30
阅读原文 ↗https://www.engadget.com/2314079/how-to-clear-application-ca