macOS System data

macOS is pretty great and bad at the same time, communicating how and what is taking up storage on one's Mac. Most users are probably familiar with using About this Mac -> Storage. Clicking on Manage will give you a more detailed view. The one point of contention is "System Data," as it's ominous and nebulous.

Below is a video that walks through the strategies of reclaiming space from the System Data, it's recommended as a companion to this blog post.


You can't just delete System Data... or can you?

macOS System data ???

I see pretty frequent posts on Reddit posts like "Can someone please explain how to get rid of the "sYsTeM dAtA" this?" or hyper verbose " Why do I have 130 gigs of system data 💀 (and how do I get rid of it cause a normal mac barely has like a 20 gigs or so of system memory) (I checked the usual culprit i.e. editing cache data but thats not it this time and I can't figure it out)".

This isn't because these individuals are incapable, rather that Apple does not clearly communicate what is happening nor give you any meaningful course of action. One user might have "System Data" that is is only 10 GB and another might have 250 GB. Why this difference is so large or why this difference even exists at all is not explained.

What is System data

System Data is the tally of the contents of the following:

  • /Library
  • /System
  • ~/Library
  • /usr
  • Invisible Files in the ~/

All these can be managed by the user with /System being the outlier. This is confusing as there are at least two Libraries on your computer and more if you have multiple users on a single computer.

Hint: Tilde (~) indicates the home directory of the user, this is a *nix convention that macOS carried over.

  • /System - This is where macOS itself resides. Under modern macOS this resides on a separate partition that isn't manipulatable by the user. To run macOS, you need this, and Apple protects its users from tampering with the /System.
  • /Library - This is the global Library accessible to all users. Things like Fonts, Audio plugins, support libraries for applications (Such as the Adobe CC suite), and assets for Final Cut Pro end up in this folder. Audio plugins end up /Library/Audio. Fonts go into /Library/Fonts, and the bulk of Application libraries into Application Support
  • ~/Library - This is hidden by default (more on this in a minute), but it uses a very similar structure to /Library with a large number of files landing in ~/Library/Application Support, things like Apple Messages, Apple Photo Libraries, Xcode Simulators, Crossover Bottles (games), Docker Containers, and Steam games within ~/Library/Application Support or ~/Library/
  • /usr - This is where CLI utilities installed by Homebrew and other applications end up.

Generally, over time, when installing various Applications and utilities, they will also install items into the Libraries and accumulate. A fresh install of macOS will have very little "System Data". An old install after many years can eat up a fair amount based on the types of applications and how frequently applications are installed. Deleting the Application via the Finder will not automatically remove them. This creates orphaned files. Official uninstallers do a much better job, as do applications like App cleaner attempt to remove files that are associated with an Application, but this is not 100% effective. In some cases, the official uninstallers from reputatable companies purposely do not uninstall entirely, like from Adobe.

Unfortunately, this requires intervention on the user, which we will cover.

Displaying the Library folder in the User directory

In the OS X days, the ~/Library (the Library folder found in /Users/your-user-name/) was a visible folder that you could easily poke around in. In modern macOSes, this is hidden, which is both good and bad. It's suitable for the basic user who probably shouldn't be manipulating it but bad for anyone with an intermediate level of familiarity with the underpinnings of their Mac. It obfuscates where storage is going on behind the scenes.

There are still multiple vectors to viewing the contents of the ~/Library. The easiest route is to go to the user directory and hit "Command Shift ." to display visible folders. Another method is to navigate to it from the Finder, select under Go, "Go To Folder..." and type in ~/Library.

You can also make the Library permanently visible either using "Get Info" from the finder (on the user directory) and checking "Show Library" or using the terminal and running the following command:

chflags nohidden ~Library

go to folder in macos

Calculating Folder Sizes

For whatever reason, still to this day, one of the advantages of macOS is the ability to calculate folder sizes from the list view. This is done by using view options "Show View Options" under View or using the keyboard shortcut, Command J. Calculating folder sizes will take time, depending on how many files are inside a folder.

Sorting folders by size makes it easy to spot where the largest folders reside.

Managing the ~/Library

The most common place to reclaim storage is from the ~/Library.

Deleting items from ~/Library is tricky as there are important files that could break applications and a few valuable system files. There's no hard-fast rule. For example, deleting a Steam game via the Finder is safe from ~/Library/Application Support/Steam/steamapps, but deleting the entire Steam Directory will cause issues. The best advice is to tread lightly. Generally, (but not always) items that land in ~/Library can be managed elsewhere. For example, Steam Games can be removed , and Apple Messages cache can be controlled via the Apple Messages app by clearing out data over a month old.

A short but incomplete list of common data hogs in ~/Library

  • ~/Library/Messages - Apple Messages can creep up in size with the number of large media files now typically shared among friends and family. Every lousy gif sent to you via text message by an aunt, gets cached in /Messages. Use Apple Messages to get a handle on your Messages.
  • ~/Library/Containers - these are freeze and sandboxed states for macOS, generally from the Mac App Store, sometimes these get orphaned. For example, if you install NBA 2K21 Arcade Edition from the Mac App Store, it'll install the application in your Apps folder and a 4 GB file within /Containers. If you delete the app by dragging the game to the trash folder from your Applications folder in the finder, you will not delete data within the container and thus will need to do this manually.
    • ~/Library/Containers/Docker - Docker is generally a requirement depending on a toolchain for developers, but containers/images are downloaded into the /Containers/Docker folder, the CLI utility is the best way to manage these.
    • ~/Library/Containers/UTM - UTM is a popular QEMU-based emulator for creating virtual machines and other operating systems. Installing the UTM virtual machines by default will install into /Containers/UTM. Virtual Machines often are multiple GBs per virtual machine, so this can be a place to reclaim a lot of space.
    • ~/Library/Containers/com.apple.mail/Data/Library/Logs - Log files for Apple Mail. In mail, select window/Connection Doctor Uncheck Log Connection Activity (Credit to JeremyAndrewErwin)
  • ~/Library/Mobile Documents - This is the iCloud driver folder. The easiest way to manage this is to go to Apple ID within the system preferences and, under iCloud drive select options.
  • ~/Library/Developer - This is the location where Xcode installs its simulator environments. This can be managed within Xcode using preferences -> Components and caches cleared from the Storage "Manage" in about this Mac.
  • ~/Library/Photos - This contains the Apple Photos library and Photo management can be done via the Photos app. The entire Photos library can be uploaded to iCloud (assuming you have a large enough iCloud subscription).
  • ~/Library/Caches - Caches are application-specific temporary data. Depending on the application, these can be deleted with little repercussions. Generally, applications provide ways to manage their own caches. Deleting them is often temporary, as using an application will cause it to create new cache files as needed. It's recommended to do this every so often as you add and remove applications and upgrade them, you may end up with orphaned caches. This is best thought of as a spring cleaning activity as opposed to daily or even weekly maintenance. The same can be done with ~/Library/Logs as occasionally, some applications can eat up hundreds of MBs and even GBs of data in log files.
  • ~/Library/ScreenRecordings - These are screen captures by QuickTime. Quicktime doesn't provide a smart way to manage these, and they are best deleted via the finder.
  • ~/Library/Application Support - this is where a bulk of Applications install user-specific data.
    • ~/Library/Application Support/Steam - Steam is a popular application store for games and game interaction, providing community features like in-game chat, and user profiles alongside its massive amount of videogames. Steam provides ways to delete games via it's user interface, but games can be found and deleted in the /steamapps folder.
    • ~/Library/Application Support/OpenEmu - OpenEmu takes an interesting approach of stashing games in the Applications Directory (as do a few emulators). Games can be managed from the UI but also deleted from Game Library/roms and artwork from Game Library/artwork
    • ~/Library/Application Support/com.splice 2.Splice - The popular subscription-based Sample library app, Splice, stores its cache within Application Support instead of ~/Library/Caches`. It can be dumped.
    • ~/Library/Application Support/RetroArch - RetroArch has a habit of stashing quite a bit of resources in /Application Support, but deleting this directory should only be done when deleting the entire emulator.
  • ~/Library/Application Support/Devonthink - Makers of document organization software, this can be a data hog (Credit to JeremyAndrewErwin)
  • ~/Library/Application Support/PFU - Scansnap scratch files, can be safely removed (Credit to JeremyAndrewErwin)

In summary, viewing the contents of your ~/Library gives you an idea of where your data is going. Once you have established what is taking up space, you can then check said application to see if you can delete or remove packages/support files/items from that application.

The Scourge of invisible folders

macOS invisible directories in finder

Toggling hidden files only a keyboard shortcut away, in the finder hit Command + Shift + . (period).

macOS has a surprising amount of invisible folders. Most are located at the root of the hard drive. These are (mostly) related to the *nix underpinnings of macOS and are essential for proper operation.

This includes bin, cores, etc, opt, private, sbin, tmp, usr, var and volumes, however in the ~/ (your user directory) has many more, as a general rule any in that start with . are created by applications and ones that are not, are OS related, which should only be Trash, which is where your Trash directory is.

Homebrew users may find that they've installed a significant amount of utilities to their usr, and it's highly recommended that you use Homebrew to remove undesired packages.

These probably will not be very large for the average user, but for developers, various versions of Node, Ruby Gems, and VScode files can end up sapping 100s of MBs if not GBs. I had an issue with Node v14 installing improperly with my M1 Max and eating 8 GB per Node V14 version.

Utilities

There are a lot of not-so-great "disk cleaner" utilities that help grapple with disk storage. I've linked two tried and true free open-source utilities that have been around for a decade plus. These aren't the only valid utilities but both allow you to understand macOS better and of course, are free.

Disk Inventory X

macOS Disk Inventory X

The old standby, Disk Inventory X still works under macOS 12 Monterey but requires right-clicking and opening to bypass security alerts. Disk Inventory X scans your entire Mac similarly to macOS's internal utility but does allow you to more quickly view what's taking up space in a Finder-like experience.

It benefits from showing hidden folders even if they're not set to visible. It's also not the fastest utility, somewhat out-of-date, or 100% accurate in identifying files. My Docker.raw file was identified as .RAW photographs in the above screenshot.

Onyx

macOS Onyx

Onyx makes deep cache scrubbing fast and easy.

While not specifically a utility for disk management, Onyx, the classic macOS tweaking utility, allows you to dump cache files on macOS quickly. More often this is less about reclaiming space but also forcing macOS to rebuild caches with newer/more accurate versions to help system performance.

This concludes my primer to managing your system data. Happy File Hunting!

Update: April 8, 2023: Much needed copy editing and minor corrections about pathing