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.

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

macOS System data ???

I see pretty frequently 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. I commented on both of these but I figured it'd be smarter just to actually make a blog post about this.

System Data is the tally of the contents of the /Library, /System and ~/Library and /usr. Three of these can be managed by the user, /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.

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.

The easiest way to view what's in your user's ~/Library is from the Finder select under Go, "Go To Folder..." and type in ~/Library. You can also make the Library 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

Managing the ~/Library

With the ~/Library, Calculating Folder sizes is going to be probably the easiest way to get a break down, this is done by using "Get Info" within library and enabling calculate sizes.

While you can delete items from your ~/Library, this isn't recommended unless you know what you're really deleting. There's no hard-fast rule. 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 via the UI 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

  • /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 /Messsages. Use Apple Messages to get a handle on your Messages.
  • /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.
    • /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.
    • /Containers/UTM - UTM is a popular QEMU based emulator for creating virtual machines 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.
    • /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)
  • /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.
  • /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.
  • /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).
  • /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 down with ~/Library/Logs as occassionally some applications can eat up hundreds of MBs and even GBs of data in log files.
  • /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.
  • /Application Support - this is where a bulk of Applications install user-specific data.
    • /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.
    • /Application Support/OpenEmu - OpenEmu takes an interesting approach of stashing games in the Applications Directory (as do a few few emulators). Games can be managed from the UI but also deleted from Game Library/roms and artwork from Game Library/artwork
    • /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.
    • /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.
  • /Application Support/Devonthink - Makers of document organization software, this can be a data hog (Credit to JeremyAndrewErwin)
  • /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 freebee 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 Invetory X

macOS Disk Inventory X

The old standby, Disk Invetory 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 rebuild caches with newer/more accurate versions to help system performance.

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