Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

macos-disk-usage

БесплатноЗапускает вложенные скриптыНе проверен

macOS disk-usage forensics and space recovery on APFS. Use when df reports a disk near-full, hunting what's eating space, reclaiming OrbStack/Docker, or…

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

macOS Disk Usage & Space Recovery

When to Use This Skill

Use this skill when... Use something else when...
df reports a volume near-full and you need the honest figure A Linux disk is full — use linux-plugin:linux-disk-usage
Hunting "what's eating my disk" on macOS General process forensics — use ps/top directly
Reclaiming space from OrbStack/Docker, caches, or local snapshots A GUI hang/freeze occurred — see macos-incident-postmortem
du totals and free space disagree (purgeable snapshots, or CoW clones) launchservicesd DB bloat specifically — see launchservices-health
Deleting a big tree freed far less than du promised —

Platform Guard

This skill is macOS-only. APFS containers, diskutil apfs, tmutil local snapshots, and BSD du block-counting are Darwin-specific. Refuse to act if uname -s is not Darwin.

test "$(uname -s)" = "Darwin" || { echo "macos-plugin: not Darwin, refusing"; exit 1; }

This skill cross-references, does not duplicate, linux-plugin:linux-disk-usage, which ships a copy of scripts/scan-suspects.sh; port scanner fixes to both. The APFS / Time Machine / OrbStack angle below is the macOS-specific complement.

Core Expertise

The single most-important macOS fact: APFS shares free space across every volume in a container. A per-volume Capacity % is therefore misleading — the sealed system snapshot volume routinely reads 99% while the container has tens of GB free. Trust the Avail column (or diskutil apfs list), never the Capacity %, or the investigation goes down the wrong path before it starts.

The second fact: du lies about reclaimable space. tmutil local snapshots hold purgeable space that du never counts, so du totals and reported free space can disagree by tens of GB. Check snapshots first when the numbers don't reconcile.

The third fact: du also over-counts in the other direction — copy-on-write clones. APFS reports a cloned file at full st_blocks even though its blocks are shared and cost nothing, so a du total can far exceed what deleting the tree would actually free. This is not fixable by switching tools: dust, gdu, and ncdu all read st_blocks and double-count identically. See CoW clones.

Step 1: Measure honestly (built-in CLI)

# Trust Avail, NOT Capacity % — APFS shares free space container-wide
df -h /

# The container's real free space, per-volume roles, and snapshot count
diskutil apfs list

# Top-level consumers, one level deep, staying on one filesystem (-x)
du -hx -d1 / 2>/dev/null | sort -h
du -hx -d1 ~ 2>/dev/null | sort -h

BSD du counts allocated blocks, so it reports the real on-disk size of sparse files (e.g. OrbStack's data.img.raw reads its true 33 GB, not its apparent size). Trust the number for sparse files — but not as a general rule: allocated blocks are also what makes du over-count clones (below), and they never include purgeable snapshot space.

When a size gates a decision ("how much will this free?"), or df barely moves after a delete, open references/cow-clones.md for the measured clone over-count, the per-package-manager table, and the df-delta recipe.

Purgeable snapshot space (the thing du hides)

When du totals and df free space disagree, local Time Machine snapshots are the usual cause:

# List local snapshots holding purgeable space
tmutil listlocalsnapshots /

# Thin them (reclaims purgeable space invisible to du); needs sudo
sudo tmutil thinlocalsnapshots / 999999999999 4

Step 1.5: Fast-path — the usual-suspects scan

Step 1 gives the honest total; this gives where it went without re-deriving the hunt by hand each time. scripts/scan-suspects.sh reads a public catalog of known reclaim targets (scripts/suspects.tsv — dev caches, build-artifact dirs, VM images), dus the ones that exist on this machine, and emits a ranked rollup with the cleanup command and safety tier already attached:

# Whole home (thorough; slower — du walks every tree)
bash "${CLAUDE_SKILL_DIR}/scripts/scan-suspects.sh" --home-dir "$HOME" --root "$HOME"

# Bound the build-artifact search to where projects live, raise the noise floor
bash "${CLAUDE_SKILL_DIR}/scripts/scan-suspects.sh" --root ~/repos --min-mb 1000

Output follows the structured SUSPECT id=… tier=… size_kb=… cmd="…" convention, plus a ranked human table and per-tier totals (TIER_SAFE_KB=…, RECLAIMABLE_SAFE=…). Work the tiers exactly as Step 4 — exhaust safe before decision, never blind-delete userdata.

⚠️ Those totals are du sums, so they are an upper bound wherever CoW clones apply, e.g. the node_modules / .venv suspects, which uv and bun clone from a global cache. Treat RECLAIMABLE_* as "at most this much"; confirm with a df delta. See [CoW clo

Полный SKILL.md на GitHub

Установить macos-disk-usage в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(bash *)
Bash(uname *)
Bash(df *)
Bash(du *)
Bash(find *)
Bash(diskutil *)
Bash(tmutil *)
Bash(docker *)
Bash(brew *)
Bash(go *)
Bash(pip *)
Bash(uv *)
Bash(dust *)
Bash(dua *)
Bash(gdu *)
Bash(ncdu *)
Bash(mise *)
Bash(git *)
Read
Grep
Glob
TodoWrite

Вложенные файлы

references/command-reference.mdreferences/cow-clones.mdreferences/repo-artifacts.mdreferences/third-party-tools.mdreferences/troubleshooting.mdscripts/scan-suspects.shscripts/suspects.tsv

FAQ

Что делает скилл macos-disk-usage?

macOS disk-usage forensics and space recovery on APFS. Use when df reports a disk near-full, hunting what's eating space, reclaiming OrbStack/Docker, or pruning caches and local snapshots.

Как установить скилл macos-disk-usage?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл macos-disk-usage запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить macos-disk-usage с