MainspringGuides › du and df
macOS Guide

Check Disk Usage From Terminal on Mac (du and df)

Updated July 2026 · 3 min read

Two commands cover disk space in Terminal: df tells you how much is left on each volume, and du tells you what's eating it, folder by folder. Together they answer the question Finder's storage bar only gestures at — and they work the same on macOS Ventura, Sonoma, and Sequoia.

Check free space with df

The -h flag makes sizes human-readable (GB instead of 512-byte blocks):

# free space on every mounted volume
df -h

Modern Macs use APFS, where several volumes share one container, so you'll see multiple entries reporting the same total size — that's normal. The line to read is /System/Volumes/Data: that's where your files actually live. External drives show up under /Volumes, so df -h /Volumes/YourDrive checks one drive directly.

Ignore the iused and ifree columns — they count file-system objects, not space. The columns that matter are Size, Used, Avail, and Capacity. One more shortcut: df -h . (with a dot) reports just the volume that contains your current folder, which is handy when you're already working deep inside an external drive and don't remember its mount name.

Find what's using space with du

du -sh gives one summarized, human-readable total per folder. Pipe it through sort -h to rank the hogs:

# size of every folder in your home, smallest to largest
du -sh ~/* | sort -h

# one folder's total
du -sh ~/Library

# silence permission-error noise
du -sh ~/* 2>/dev/null | sort -h

Work top-down: run it on your home folder, then cd into the biggest result and run du -sh * | sort -h again until you hit the actual files. ~/Library is where invisible bulk hides — caches, old iPhone backups, developer tools.

A few locations account for most mystery bulk, so check them by name before sweeping everything: ~/Library/Caches collects per-app scratch data, ~/Library/Application Support/MobileSync/Backup holds local iPhone and iPad backups that easily run tens of gigabytes, and ~/Library/Developer balloons on any Mac that has ever run Xcode. For system-owned areas outside your home folder, prefix the command with sudo — for example sudo du -sh /private/var/log — and enter your password when prompted. Expect du to take a while on big folders; unlike Spotlight, it reads the real folder tree every time, which is also why its answer is trustworthy.

Fix "Operation not permitted" errors

macOS blocks Terminal from protected folders like Desktop, Documents, and Mail until you grant it Full Disk Access:

  1. Open System SettingsPrivacy & SecurityFull Disk Access.
  2. Click +, add Terminal from Applications → Utilities, and switch its toggle on.
  3. Quit and reopen Terminal so the permission takes effect.

This is reversible: switch the toggle off in the same pane whenever you're done auditing.

Why df, du, and Finder disagree

Finder's "available" figure includes purgeable space — local Time Machine snapshots, cached iCloud files, and other data macOS will delete on demand when something needs room. df reports the stricter number: what's free right now. So Finder often looks more optimistic than Terminal, and deleting files sometimes "frees" nothing in df until a snapshot expires. Neither is lying; they're answering slightly different questions. If the gap is huge, snapshots are the usual culprit — tmutil listlocalsnapshots / shows them.

Units add a second, smaller discrepancy. df -h and du -h report binary units — a "G" here is 1,073,741,824 bytes — while Finder and Disk Utility use decimal gigabytes, the same convention drive manufacturers use. The Terminal figure will therefore always look about seven percent smaller for the same data. Nothing is missing; it's the same bytes divided by a different number, so compare df to df and Finder to Finder rather than mixing the two.

Skip the spelunking

While you're tidying your disk, Mainspring turns 90+ hidden macOS settings into labelled, reversible toggles — every tweak has a plain-English description and a one-click undo.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

When the numbers point at big files

du ranks folders, but once you know where the weight is, hunting individual multi-gigabyte files is faster with a targeted search — see how to find large files on a Mac for both the Finder and Terminal routes.