Skip to content

About

A macOS cache and system-file cleaner for the Terminal. It is built as a single Bash script with zero dependencies and is fully compatible with native macOS (Bash 3.2+).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

cleanShit

A macOS cache & system-file cleaner for the terminal. Built with a single Bash script, zero dependencies, and 100% compatible with macOS built-in Bash (3.2+).

⚠️ CRITICAL WARNING: Files are deleted PERMANENTLY (not moved to the Trash) and cannot be recovered.
A preview mode and an explicit DELETE confirmation prompt are always required before any deletion takes place.


🚀 Features

  • Zero Dependencies: Runs natively on macOS using the built-in Bash 3.2+ with no additional packages required.
  • "System Data" Diagnostic (--scan): Analyzes the largest folders in ~/Library to diagnose System Data storage usage without deleting anything (read-only).
  • Interactive Checklist Menu: Easily toggle specific cleanup categories according to your needs.
  • Double Safety Protection: Strict path whitelists and blacklists prevent accidental deletion of critical system or user files.
  • Comprehensive Cleanup: Clears Xcode/iOS Simulator caches, Package Managers, Docker, Web Browsers, Messaging apps, Diagnostic logs, and flushes System DNS & QuickLook.

📦 Cleanup Categories

# Category Description & Target Locations Default Sudo
1 User caches & logs ~/Library/Caches/*, ~/Library/Logs/* [x] –
2 Dev & IDE caches VS Code, JetBrains, Cursor, Zed, pip, npm, + brew cleanup -s [x] –
3 Xcode build artifacts DerivedData (build output, module & symbol cache), SwiftUI Previews, IB Support, DocumentationCache, DocumentationIndex, Xcode & Instruments caches, SwiftPM cache [x] –
4 Xcode Archives & Products ~/Library/Developer/Xcode/Archives, Products — ⚠️ opt-in, see warning below [ ] –
5 Simulators & Device Support iOS/watchOS/tvOS/macOS/visionOS DeviceSupport, iOS Device Logs, CoreSimulator caches & temp, XCTestDevices, + xcrun simctl delete unavailable [x] –
6 Package Managers CocoaPods, Yarn, pnpm, Bun, Gradle, Cargo caches + pod cache clean --all [x] –
7 Docker system & builder cache Docker builder & image cache via docker system prune -f && docker builder prune -f [ ] –
8 Browser caches Cache directories for Google Chrome, Safari, Brave, Arc, and Microsoft Edge [x] –
9 Messaging caches Temporary media & cached files for Slack, Discord, and WhatsApp [x] –
10 Diagnostic & crash reports Diagnostic crash reports in ~/Library/Logs/DiagnosticReports & /Library/Logs/DiagnosticReports [x] ✅
11 Trash ~/.Trash/* [x] –
12 Downloads ~/Downloads/* (Opt-in, deletes everything in the Downloads directory) [ ] –
13 System caches & flush /Library/Caches/*, Refresh QuickLook (qlmanage -r cache) & Flush DNS (dscacheutil -flushcache) [ ] ✅

⚠️ Note for Xcode developers

Category 4 (Xcode Archives & Products) is deliberate opt-in. An .xcarchive contains the dSYM files for a build you shipped. Delete them and crash reports coming back from the App Store or TestFlight for that build can never be symbolicated again. Only clear archives for builds you never released, or make sure the dSYMs are already uploaded to your crash reporter first.

Everything in category 3 and 5, by contrast, is regenerated by Xcode on the next build or the next device connection — safe to clear as often as you like. Note that clearing DerivedData makes the next build a full rebuild, and clearing DeviceSupport makes Xcode re-copy symbols the next time you plug that device in.


💻 Usage

1. Make Executable (Once)

chmod +x clean.sh

2. Command Options (Flags)

./clean.sh            # Full interactive mode (Menu -> Preview -> Confirm DELETE -> Purge)
./clean.sh --scan     # Read-Only Analysis Mode: Check largest folders & total reclaimable cache without deleting
./clean.sh --dry-run  # Simulation Mode: Display preview without deleting anything
./clean.sh --help     # Display usage help

3. Interactive Menu Controls

When running ./clean.sh:

  • Type numbers (e.g. 1 3 5): Toggle specific category checkboxes.
  • Type a: Select all categories (Select All).
  • Type n: Deselect all categories (Deselect All).
  • Press Enter: Proceed to Preview mode for selected categories.
  • Type q: Quit immediately without deleting anything.

👨‍💻 Author

🔗 GitHub Repository

About

A macOS cache and system-file cleaner for the Terminal. It is built as a single Bash script with zero dependencies and is fully compatible with native macOS (Bash 3.2+).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages