A simple bash script to clean Xcode cache files, SwiftUI Previews, DerivedData, iOS/macOS DeviceSupport, and Archives.
- Interactive Directory Selection: Navigate through directories and subfolders to delete specific items.
- Sort by Last Used Date: Prioritize cache removal based on when directories were last accessed.
- User-Friendly Warnings and Display: Provides clear, detailed information with formatted tables and alerts before any action.
- Quick Cleanup Options: Easily remove all cache directories or selectively delete specific ones.
- Delete All Directories: Removes all listed Xcode cache directories.
- Select Specific Directories: Explore directories and delete specific subfolders or files interactively.
Found the following Xcode cache directories (sorted by last used date):
---------------------------------------------------------------
No. Last Used Size Path
---------------------------------------------------------------
1 2025-01-28 15:00:00 19G /Users/username/Library/Developer/Xcode/DerivedData
2 2025-01-25 12:30:00 9.0M /Users/username/Library/Developer/Xcode/Archives
3 2025-01-22 10:20:00 219M /Users/username/Library/Developer/Xcode/Products
---------------------------------------------------------------
Total size: ~19.2 GB
Run the script directly from the terminal using the following command:
curl -fsSL https://raw.githubusercontent.com/filsv/clean-my-xcode/main/clean-my-xcode.sh -o clean-my-xcode.sh && bash clean-my-xcode.sh
For an even quicker execution without downloading the file:
bash <(curl -fsSL https://raw.githubusercontent.com/filsv/clean-my-xcode/main/clean-my-xcode.sh)
This project is licensed under the MIT License. See the LICENSE file for details.