Skip to content

aburakt/cleanup-macos-sysdata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

macOS System Data Cleanup (Scripts)

Safely reduce macOS "System Data (Other Storage)" with two simple scripts.

🚀 What's Inside

  • scripts/cleanup-macos-sysdata.sh: General cleanup (cache/log/tmp + optional extras)
  • scripts/cleanup-rn-macos.sh: Opinionated cleanup for React Native developers
  • scripts/install-cleanup.sh: One-step installer for wrapper commands

Safe defaults: By default, only user space (~/Library) is cleaned. System paths are opt‑in and may require sudo.


⚡ Quick Start (Recommended)

git clone https://github.com/<user>/macos-sysdata-cleanup.git
cd macos-sysdata-cleanup

# No sudo needed
bash scripts/install-cleanup.sh

# Try it
cleanup-macos-sysdata --dry-run
cleanup-rn-macos --dry-run

The installer drops cleanup-macos-sysdata and cleanup-rn-macos into ~/.local/bin and can update your shell rc so they are available immediately.

Install scope

# Only the general command
bash scripts/install-cleanup.sh --only-sysdata

# Only the RN command
bash scripts/install-cleanup.sh --only-rn

# Both (default) or interactive picker
bash scripts/install-cleanup.sh --both
bash scripts/install-cleanup.sh   # asks 1/2/3 in TTY

Alternative: Aliases

alias cleanup-macos-sysdata="bash ~/path/to/macos-sysdata-cleanup/scripts/cleanup-macos-sysdata.sh"
alias cleanup-rn-macos="bash ~/path/to/macos-sysdata-cleanup/scripts/cleanup-rn-macos.sh"
source ~/.zshrc

Setup Troubleshooting

# If you see: sudo: ./install-cleanup.sh: command not found
bash scripts/install-cleanup.sh

# Or make executable and run directly
chmod +x scripts/install-cleanup.sh
./scripts/install-cleanup.sh

🧼 Usage – General Script

Start safe: preview changes first with --dry-run.

# Preview only
bash scripts/cleanup-macos-sysdata.sh --dry-run

# Safe defaults (no prompts)
bash scripts/cleanup-macos-sysdata.sh --yes

# Include browsers, Xcode, simulators
bash scripts/cleanup-macos-sysdata.sh --yes --browsers --include-xcode --include-simulators

# System caches/logs + Time Machine local snapshots (sudo recommended)
sudo bash scripts/cleanup-macos-sysdata.sh --yes --system-caches --system-logs --tm-local-snapshots

# Age filter example
bash scripts/cleanup-macos-sysdata.sh --yes --days 14

Flags (General)

  • --dry-run, --yes|-y, --days N
  • --user-caches/--no-user-caches, --logs/--no-logs, --tmp/--no-tmp
  • --system-caches, --system-logs, --tm-local-snapshots
  • --include-homebrew, --browsers, --include-xcode, --include-simulators, --include-docker, --include-ios-backups

🧹 Usage – React Native Script

# Preview
scripts/cleanup-rn-macos.sh --dry-run

# Non‑interactive
scripts/cleanup-rn-macos.sh --yes

# Target a project
scripts/cleanup-rn-macos.sh --yes --project ~/Projects/my-rn-app

# Aggressive: wipe all simulator disk images
scripts/cleanup-rn-macos.sh --yes --wipe-simulators

Cleans up:

  • Xcode DerivedData and Simulator cache/disk/log
  • Metro / Watchman temp files
  • Gradle cache and Android AVD images
  • CocoaPods cache/repos and project Pods
  • npm/yarn/pnpm caches
  • Optional Homebrew cleanup

⚠️ Warnings

  • Use sudo when system paths are involved.
  • First build may take longer after clearing Xcode/Simulator/Gradle/AVD/Pods.
  • --wipe-simulators deletes all simulator disk images permanently.

🧩 FAQ

Why prefer aliases? They call the script via bash, avoiding permission changes while keeping convenience.

How much space can I free? It varies. Xcode/Simulator/AVD/Docker assets grow fast; periodic cleanup often frees many GBs.


🌍 Turkish Version

See README-tr.md for Turkish docs.


📄 License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages