Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mac-storage-cleanup

一個用於 Codex 的 macOS 儲存空間清理 Skill。它會先盤點整台 Mac 的實際可用容量,再分析快取、System Data、Xcode、Simulator 與其他開發資料,提出白話且可選擇的清理方案。

特色

  • general:給一般使用者的低風險清理流程。
  • developer:給 macOS、Xcode、iOS Simulator、套件管理器與 Docker 使用者的進階流程。
  • df 的實際可用容量為準,不盲信 du 加總。
  • 遇到 APFS clone、sparse file、shared blocks 或掛載映像時,先診斷再決定。
  • 依優先度列出候選資料,提供保守、平衡與開發者方案。
  • 刪除前要求使用者選擇,刪除後逐批驗證容量變化。

使用方式

在 Codex 中使用:

使用 $mac-storage-cleanup,模式:一般使用者

或:

使用 $mac-storage-cleanup,模式:開發者

也可以直接指定目標:

使用 $mac-storage-cleanup developer,將 Mac 可用容量清理到 70GB。

盤點腳本

scripts/audit-storage.sh 是只讀腳本,不會刪除檔案:

./scripts/audit-storage.sh general
./scripts/audit-storage.sh developer

兩種模式都會先檢查:

  • macOS Data volume 的實際可用容量
  • Data volume 與家目錄的高層級分布
  • ~/Library
  • ~/Library/Caches
  • ~/Library/Application Support
  • ~/Library/Developer

這也保留了最初使用的四組容量盤點指令。developer 模式另外檢查 APFS、local snapshots、/private/var、CoreSimulator、Xcode 快取、Simulator devices、Simulator runtimes 與掛載的 disk images。

清理流程

建立容量基線
    -> 分層盤點
    -> 分析 APFS 與資料風險
    -> 依優先度提出候選項目
    -> 提供三種清理方案
    -> 使用者選擇
    -> 分批清理
    -> 重新驗證實際可用容量

安全界線

Skill 預設不處理以下資料:

  • Documents、Desktop、Downloads、Photos、iCloud 文件
  • 程式碼專案、未提交的修改與開發工作區
  • Mail、Messages、Keychains 與未知的應用程式資料庫
  • /System/private/var/vm/private/var/db
  • root 擁有的 CoreSimulator runtime、dyld cache、swap 或 sleep image

XCTestDevices、Simulator Runtime、Xcode Archives、Docker volumes 與 Time Machine snapshots 都屬於需要明確確認的項目,不會因為 du 顯示很大就直接刪除。

預設保留以下三個 Simulator devices:

  • iPhone 17
  • iPhone 16e
  • iPhone 17 Pro Max

目錄

SKILL.md
agents/openai.yaml
scripts/audit-storage.sh
references/
├── general-cleanup.md
├── developer-system-data.md
└── cleanup-policy.md

About

Safe macOS storage auditing and cleanup with general and developer modes.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages