Your Mac says it has 40 GB of "Other" or "System Data" but gives you no breakdown. The fastest way to start a real investigation is a single Terminal command that measures every folder in a directory and sorts the results from largest to smallest. This article covers the exact incantation, explains each flag, shows why the human-readable sort works on modern macOS, and gives you a saved alias so you never have to remember the syntax again.
The Core Command: du -sh * | sort -rh
Open Terminal (press Command + Space, type Terminal, press Return) and run:
du -sh * | sort -rh
That's it. Run this from any directory and you'll get every item in that folder, sorted from biggest to smallest, with human-readable sizes like 4.2G or 812M.
What each flag does
du: disk usage. It walks the filesystem and reports how much real disk space each item occupies (accounting for all nested contents).-s: summarize. Instead of printing every sub-file individually, it gives one total per argument. Without-syou'd get thousands of lines.-h: human-readable. Sizes print asK,M, orGinstead of raw 512-byte blocks.*: expand to every visible item in the current directory. Hidden files (dotfiles) are excluded; see below for how to include them.| sort -rh: pipe the output tosort. The-hflag onsortunderstands human-readable suffixes, so4.2Granks above812M. The-rreverses the order so the biggest items appear first.
Why -h Works on macOS sort (and When It Doesn't)
The -h flag on sort (sometimes called human-numeric-sort) has been part of GNU coreutils for years, but macOS ships BSD userland tools. The good news: macOS Monterey and later include a version of sort that accepts -h. On macOS Sonoma, Sequoia, and Tahoe this command works out of the box with no extra installs.
If you're on an older macOS version or you get an error like sort: invalid option -- h, you have two options:
- Install GNU coreutils via Homebrew (
brew install coreutils) and usegsort -rhinstead ofsort -rh. - Use a numeric sort workaround that converts sizes to bytes first (more complex, rarely necessary in 2025+).
On any Mac running a recent macOS release, the plain sort -rh form works correctly. No Homebrew required.
Practical Workflow: Finding the Big Folders
Start at the home directory
The most useful place to begin is your home folder:
cd ~
du -sh * | sort -rh
This immediately shows which top-level folders are consuming the most space: Movies, Downloads, Library, and so on. From there you can drill in.
Include hidden files and folders
The * glob skips dotfiles. To include hidden items, use .[^.]* * or switch to a brace expansion:
du -sh .[^.]* * 2>/dev/null | sort -rh
The 2>/dev/null suppresses "permission denied" messages for folders your user account can't read. This matters in your home directory where some dotfiles are locked by system processes.
Dig into Library
The ~/Library folder is hidden by default but is usually one of the largest contributors. Navigate into it and run the same command:
cd ~/Library
du -sh * 2>/dev/null | sort -rh
Common large subfolders you'll find here:
~/Library/Caches: app caches that can often be cleared safely.~/Library/Application Support: app data, some of which may belong to apps you've already deleted.~/Library/Containers: sandboxed app data for Mac App Store apps.~/Library/CloudStorage: iCloud Drive and other cloud sync folders stored locally.~/Library/Mobile Documents: another iCloud path worth checking.
Check system-level directories (requires sudo)
Some large folders live outside your home directory. To measure those you need elevated privileges:
sudo du -sh /var/folders/* 2>/dev/null | sort -rh
sudo du -sh /private/var/db/* 2>/dev/null | sort -rh
Use caution here. These are system directories and the sizes are informational. Do not delete contents without knowing exactly what each folder contains.
Save a Shell Alias So You Never Forget the Syntax
The du -sh * | sort -rh command is useful enough to keep at your fingertips. Add a short alias to your shell config so you can type dusort from any directory.
For zsh (the default shell on Apple Silicon and recent Intel Macs)
# Open your zsh config
nano ~/.zshrc
# Add this line anywhere in the file
alias dusort='du -sh .[^.]* * 2>/dev/null | sort -rh'
# Save (Control+O, Return) and reload
source ~/.zshrc
For bash
echo "alias dusort='du -sh .[^.]* * 2>/dev/null | sort -rh'" >> ~/.bash_profile
source ~/.bash_profile
Now any time you navigate to a directory in Terminal, typing dusort gives you an instant ranked breakdown. No flags to remember.
Limitations of du on Mac
The du approach is fast and built-in, but it has real constraints worth understanding before you act on the results.
- No context on what's safe to delete.
dutells you a folder is 8 GB; it has no idea whether deleting it would break an app or lose data. - APFS snapshots and Time Machine are invisible. On APFS volumes, local Time Machine snapshots can consume significant space that
dudoesn't attribute to any visible folder. Check withtmutil listlocalsnapshots /andtmutil thinlocalsnapshots / 9999999999999 4to reclaim that space. - System Data is opaque. Much of what macOS labels "System Data" in About This Mac lives in protected locations that your user account can't fully traverse. You'll see "permission denied" for many paths even with
2>/dev/nullsuppressing the noise. - iCloud placeholders count as zero. Files stored in iCloud but not downloaded locally show their on-disk placeholder size (often just a few kilobytes), not the actual file size. The full picture requires downloading or using a tool that reads iCloud metadata.
- Hardlinks are counted once per reference. APFS uses hardlinks for certain system files.
dumay double-count or under-count depending on the traversal path.
Going Deeper: du Across the Whole Disk
To get a full picture of the largest folders anywhere on your Mac, you can run du from the root. This takes several minutes and requires sudo:
sudo du -sh /* 2>/dev/null | sort -rh | head -20
The head -20 limits output to the top 20 entries. From there you can drill into any path that looks unexpectedly large.
A more targeted version scans your home directory recursively and prints the 20 biggest folders at any depth:
du -h ~ 2>/dev/null | sort -rh | head -20
Note: this version drops the -s flag, so du prints every subfolder. Combined with sort -rh | head -20 you get the top offenders across all nesting levels, not just the top-level directories.
When You Want the Full Picture Without the Terminal Work
The du workflow is powerful for targeted investigations, but it requires you to navigate directory by directory and interpret raw output. If you want an automatic ranked view across your entire disk, including caches, app leftovers, and duplicate files, Crumb's largest-items list does this scan automatically and presents results as a reviewable list before anything is removed. It runs entirely on-device with no account needed. Useful as a complement when the Terminal output leaves you unsure what's actually safe to clear.