
Mac Software Storage Cleanup
- 48 installs
- 16 repo stars
- Updated July 13, 2026
- yangsonhung/awesome-agent-skills
Helps with ai & agent building tasks.
About
mac-software-storage-cleanup is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- mac-software-storage-cleanup
- AI & Agent Building
- AI-coding skill
Mac Software Storage Cleanup by the numbers
- 48 all-time installs (skills.sh)
- +2 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #7,473 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 1, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yangsonhung/awesome-agent-skills --skill mac-software-storage-cleanupAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 48 |
|---|---|
| repo stars | ★ 16 |
| Last updated | July 13, 2026 |
| Repository | yangsonhung/awesome-agent-skills ↗ |
What it does
Helps with ai & agent building tasks.
Files
Mac Software Storage Cleanup
Audit installed software and storage usage on macOS, produce prioritized cleanup recommendations, and execute low-risk cleanup only after confirmation.
When to use
Use this skill when the user:
- Wants to inspect software installed under
/Applications,~/Applications, Homebrew Formula, or Homebrew Cask - Wants storage usage ranked by size across apps and common cache locations
- Wants to clean low-risk paths such as
~/Library/Cachesand~/Library/Developer/CoreSimulator - Wants reclaim recommendations with low-risk and medium-risk cleanup separated clearly
Do not use
Do not use this skill when:
- The user wants to uninstall one specific app instead of doing storage governance
- The user asks to delete application data directly without explicit confirmation
- The environment is not macOS or the target paths do not apply
Instructions
1. Run scripts/report_sizes.sh first to inventory install sources and major storage consumers. 2. Classify cleanup candidates by priority:
- Priority 1: caches and simulator data, generally low risk.
- Priority 2: application data directories, report only and never delete by default.
- Priority 3: low-yield small caches or logs.
3. Reports must show category totals, counts, and Top N largest entries. 4. To inspect priority-2 candidates, run scripts/list_priority2_candidates.sh [target_dir] [TopN]. 5. Only after explicit user confirmation, run scripts/cleanup_priority1.sh or an equivalent low-risk cleanup action. 6. After cleanup, recompute usage and show a before -> after -> reclaimed summary.
Workflow
Inventory install sources and storage usage
-> identify high-value cleanup targets
-> present prioritized recommendations
-> wait for user confirmation
-> run low-risk cleanup
-> verify reclaimed spaceRun commands
bash scripts/report_sizes.sh
bash scripts/list_priority2_candidates.sh ~/Library/Application\\ Support 20
bash scripts/cleanup_priority1.shOutput requirements
- Show counts and total size for each path category
- List Top N largest consumers so the user can decide quickly
- Every cleanup action must include before-and-after comparison
- Do not delete priority-2 directories without explicit user approval
Boundaries
- Do not use destructive git commands
- Do not delete unconfirmed application data
- If a script fails, fall back to read-only inspection or the smallest safe cleanup scope
#!/usr/bin/env bash
set -euo pipefail
size_kb() {
local p="$1"
if [ -d "$p" ]; then
local out
out="$(du -sk "$p" 2>/dev/null || true)"
if [ -n "$out" ]; then
awk 'NR==1 {print $1+0}' <<<"$out"
else
echo 0
fi
else
echo 0
fi
}
human() {
local kb="${1:-0}"
awk -v kb="$kb" 'BEGIN {
if (kb >= 1048576) printf "%.2f GB", kb/1048576;
else if (kb >= 1024) printf "%.2f MB", kb/1024;
else printf "%d KB", kb;
}'
}
CACHES="$HOME/Library/Caches"
CORESIM="$HOME/Library/Developer/CoreSimulator"
before_caches=$(size_kb "$CACHES")
before_sim=$(size_kb "$CORESIM")
[ -d "$CACHES" ] && find "$CACHES" -mindepth 1 -maxdepth 1 -exec rm -rf {} + 2>/dev/null || true
[ -d "$CORESIM" ] && find "$CORESIM" -mindepth 1 -maxdepth 1 -exec rm -rf {} + 2>/dev/null || true
after_caches=$(size_kb "$CACHES")
after_sim=$(size_kb "$CORESIM")
before_total=$((before_caches + before_sim))
after_total=$((after_caches + after_sim))
freed=$((before_total - after_total))
echo "Caches: $(human "$before_caches") -> $(human "$after_caches")"
echo "CoreSimulator: $(human "$before_sim") -> $(human "$after_sim")"
echo "Total: $(human "$before_total") -> $(human "$after_total")"
echo "Freed: $(human "$freed")"
#!/usr/bin/env bash
set -euo pipefail
TARGET="${1:-$HOME/Library/Application Support}"
LIMIT="${2:-30}"
if [ ! -d "$TARGET" ]; then
echo "目录不存在: $TARGET"
exit 1
fi
echo "Priority 2 候选目录(默认只读,不删除)"
echo "扫描目录: $TARGET"
echo "Top $LIMIT"
echo
# 仅输出一级子目录,避免误伤;排序后便于人工确认
find "$TARGET" -mindepth 1 -maxdepth 1 -print0 |
while IFS= read -r -d '' p; do
out="$(du -sk "$p" 2>/dev/null || true)"
if [ -n "$out" ]; then
awk -F'\t' 'NR==1 {print $1"\t"$2}' <<<"$out"
fi
done |
sort -nr |
awk -F'\t' -v limit="$LIMIT" '
function human(kb){
if (kb >= 1048576) return sprintf("%.2f GB", kb/1048576)
if (kb >= 1024) return sprintf("%.2f MB", kb/1024)
return sprintf("%d KB", kb)
}
NR <= limit { printf "%s\t%s\n", human($1), $2 }
'
echo
echo "提示: 优先级2目录通常包含应用业务数据,删除前需逐项确认。"
#!/usr/bin/env bash
set -euo pipefail
OUT="${1:-$HOME/software_sizes_report_$(date +%F).txt}"
humanize_kb() {
awk -F'\t' '
function human(kb){
if (kb >= 1048576) return sprintf("%.2f GB", kb/1048576)
if (kb >= 1024) return sprintf("%.2f MB", kb/1024)
return sprintf("%d KB", kb)
}
{ printf "%s\t%s\n", human($1), $2 }
'
}
collect_dir() {
local dir="$1"
if [ -d "$dir" ]; then
find "$dir" -maxdepth 1 -mindepth 1 ! -name '.DS_Store' ! -name '.localized' -print0 |
while IFS= read -r -d '' p; do
du -sk "$p" 2>/dev/null | awk -F'\t' '{print $1"\t"$2}'
done | sort -nr
fi
}
{
echo "软件占用大小报告"
echo "生成时间: $(date '+%Y-%m-%d %H:%M:%S %Z')"
echo
echo "=== /Applications ==="
collect_dir "/Applications" | humanize_kb
echo
echo "=== ~/Applications ==="
collect_dir "$HOME/Applications" | humanize_kb
echo
if command -v brew >/dev/null 2>&1; then
BREW_PREFIX=$(brew --prefix)
if [ -d "$BREW_PREFIX/Cellar" ]; then
echo "=== Homebrew Formula (Cellar) ==="
collect_dir "$BREW_PREFIX/Cellar" | humanize_kb
echo
fi
if [ -d "$BREW_PREFIX/Caskroom" ]; then
echo "=== Homebrew Cask (Caskroom) ==="
collect_dir "$BREW_PREFIX/Caskroom" | humanize_kb
echo
fi
fi
} > "$OUT"
echo "$OUT"