ClearDisk
Buy for $10Download ClearDiskDownload
A LITTLE MORE CLARITY

How to check disk space on Mac in Terminal

To check disk space on Mac in Terminal, run df -h / /System/Volumes/Data for volume capacity and du -sh ~/Library/* | sort -h to rank hidden folders. Both commands only read the disk so you can review files safely in Finder.

1. Open Terminal and understand the two safe commands

Apple’s guide gives two routes: open Launchpad and type Terminal, or open the /Applications/Utilities folder in Finder and double-click Terminal. Everything below uses two commands that only read the disk. df reports how full a volume is; du adds up the size of a folder. Neither changes a file.

Prefix nothing with sudo and do not paste commands that start with rm. This guide deliberately contains no deletion command, because the point of measuring in Terminal is to know what to remove in Finder, where the Trash gives you a way back.

2. Size the whole disk with df

Run df -h / and read the Avail column. On current macOS, / is the sealed system volume, so its Used figure counts only macOS itself and barely moves; Avail is the free space every volume on the disk shares. It does not include the purgeable space that Disk Utility and Storage settings fold into their available figure, which is why Terminal can show less room than System Settings does. Add /System/Volumes/Data to see what your own files and apps use.

Write the Avail figure down. After any cleanup, run the same command again; the change in Avail is what you actually reclaimed, and it is the only number that settles arguments with a storage bar.

df -h / /System/Volumes/Data

3. Rank the Library folders with du

Run du -sh ~/Library/* 2>/dev/null | sort -h to size every folder inside your user Library and list them smallest to largest; the last lines are the ones that matter. The 2>/dev/null part hides permission errors for folders macOS keeps private. To go one level deeper into a big one, repeat with its path, for example du -sh ~/Library/Caches/* 2>/dev/null | sort -h.

Expect Caches, Containers, Application Support, Developer, Mail and Messages near the bottom of the sorted list. The Library guide explains what each holds and which ones to leave alone; the numbers you have just produced tell you which of them to read about first.

du -sh ~/Library/* 2>/dev/null | sort -h
du -sh ~/Library/Caches/* 2>/dev/null | sort -h

4. Find the hidden folders in your home folder

Developer tools keep caches in folders whose names start with a dot, which Finder hides. Run du -sh ~/.[!.]* 2>/dev/null | sort -h to size them. Typical entries are .npm, .cache, .cargo, .gradle and .docker, and on a developer Mac they can outweigh the Library.

For projects, du -sh ~/Projects/*/node_modules 2>/dev/null | sort -h, adjusted to your folder name, lists every node_modules by size in one command. The node_modules and package-cache guides cover what to do with them.

du -sh ~/.[!.]* 2>/dev/null | sort -h
du -sh ~/Projects/*/node_modules 2>/dev/null | sort -h

5. What Terminal cannot see, and where to go next

Terminal is limited by permissions like any app. Folders macOS protects return errors until you grant Terminal Full Disk Access under System Settings → Privacy & Security, and even then local snapshots, purgeable space and other volumes are not in a du total. If the folders you measured do not add up to the used figure from df, that gap is the explanation, not a hidden file.

Take the list to Finder: Go → Go to Folder with the path, review, move to the Trash, and empty it after the app has run again. A disk scanner produces the same list with allocated sizes and labels in one pass and adds a Reveal in Finder button, which is the step this guide does by hand. ClearDisk’s scan is free and runs locally; its cleanup is the same Trash-first move, from inside the app.

Common questions

How do I check how much free space I have on Mac using Terminal?

Run df -h / and read the Avail column, which shows the free space every volume on the disk shares; this doesn't include the purgeable space that Disk Utility and Storage settings fold into their own available figure. Add /System/Volumes/Data to see what your own files and apps use.

What Terminal command shows the biggest folders in Library?

Run du -sh ~/Library/* 2>/dev/null | sort -h, which sizes every folder in your user Library smallest to largest so the last lines are the ones that matter. Repeat the same command one level deeper into any large folder to narrow it down further.

Is it safe to delete files using Terminal commands I found online?

This kind of guide deliberately avoids any deletion command, using only df and du, which read the disk without changing anything. Take what you measure to Finder instead and remove files through the Trash, so you keep the option to put them back.

Why does Terminal say permission denied when I check folder sizes?

Terminal is limited by permissions like any app, and folders macOS protects return errors until you grant Terminal Full Disk Access under System Settings, Privacy and Security. Even with that access, local snapshots and purgeable space still won't show up in a plain du total.

References & further reading

These guides combine the linked official guidance with ClearDisk’s documented behavior. Your files and app settings determine the right next step.

Main guide: how to check storage on Mac · Related pillar: how to find large files on Mac · Browse all Check storage guides →

FROM A NUMBER TO AN ANSWER

See what’s using
your space.

Explore your Mac with ClearDisk’s free local scanner.
Review the files. Keep the control.

Download free scannermacOS 15+ · version 2.2.1Cleanup license: $10 once