Skip to content
Command lineOverview

The census command line

census is the Disk Census engine as a command. It runs the app's scan, findings and cleanup from your terminal, your scripts and your AI agents.

On this page

What census does

census scans your Mac’s disk, shows what is using the space, and deletes only what you choose. It is the engine inside the Disk Census app: the app starts census serve and talks to it in JSON. The app, your scripts and your AI agents all work from the same saved scan, under the same safety rules.

  • Reading is safe. Scanning and every query only read. They never move or change your files.
  • Deleting is permanent. Nothing goes to the Trash. Only a few commands delete anything, and they ask first. See Safety and deletion.
  • Scripts get JSON. Add --json to any command and it prints exactly one JSON document. See JSON output.

Get census

census ships inside the app, at Disk Census.app/Contents/Helpers/census. You don’t download it separately, and it updates with the app. Your Disk Census license covers the command line too.

To use it in Terminal, open Disk Census, go to the CLI and Agents tab, and turn on the command line. The app adds census to your shell. Then open a new Terminal window and check the version:

Terminal
census version --json
JSON
{
  "schema_version": 5,
  "command": "version",
  "status": "ok",
  "exit_code": 0,
  "errors": [],
  "warnings": [],
  "scan": null,
  "results": { "version": "0.1.0", "schema_version": 5 }
}

census runs on macOS 12 or later, on Apple silicon and Intel Macs.

Your first commands

Scan the startup drive, then ask the saved scan questions. Queries read the saved scan instead of walking the disk again.

Terminal
# Scan the whole startup drive and print a summary
census

# The largest folders, three levels deep
census top

# Files over 1 GB that you haven't opened in a year
census large --min-size 1G --not-opened 365

# What is safe to clean, and what needs your judgment
census findings

The Quickstart walks through a first scan and cleanup from start to finish.

Commands

CommandWhat it doesEffect
scanScans a scope and saves its tree for later queries. census alone runs it.Read-only
reportShows the last saved scan report for a scope.Read-only
scansLists every saved scan.Read-only
breakdownGroups the scanned space into storage buckets.Read-only
topShows the largest folders, or the largest files with --files.Read-only
lsShows a saved folder’s contents.Read-only
typesShows file types and their share of the scan.Read-only
historyShows how used space changed over the last hour, day, week and month.Read-only
findingsLists cleanup findings, grouped as safe, review and keep.Read-only
largeLists the largest files or folders you can delete.Read-only
duplicatesFinds identical files and the space extra copies take. Alias: dupes.Read-only
appsLists installed apps and the Library items that belong to them.Read-only
appShows one app and its Library items.Read-only
leftoversLists possible leftovers of apps you removed.Read-only
cleanDeletes the safe tier and saves the rest for review.Deletes
reviewShows what needs a person and lets you choose what to delete.Deletes
applyDeletes the paths a selection file lists.Deletes
empty-trashEmpties every Trash you own.Deletes
uninstallRemoves an app and the data named after it.Deletes
maintainLists or runs maintenance tasks, such as rebuilding Quick Look’s cache.Runs tasks
optimizeCleans the safe tier and runs the quick maintenance tasks, after one confirmation.Deletes
exportSaves a scan report as JSON, Markdown, HTML or CSV.Read-only
accessShows whether this process has Full Disk Access.Read-only
versionPrints the package and schema versions.Read-only
selftestChecks incremental rescans against full scans in a temporary folder.Read-only
helpShows every command, or one command’s options.Read-only
serveAnswers JSON requests on stdin, for the app and other programs.Per request

Scripts and AI agents

Every command takes --json, and the exit code tells you what happened. Read JSON output and Exit codes and errors before you script against census.

AI coding agents use the same commands. The census skill teaches them to clean the safe tier when you ask, show you everything else, and delete only what you choose. See Census for AI agents.

Updated · census JSON schema 5