Created
April 7, 2026 15:50
-
-
Save tewha/57f0b1c12f7eb519735bad4d2ba57050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import os | |
| import shutil | |
| from pathlib import Path | |
| DERIVED_DATA = Path.home() / "Library/Developer/Xcode/DerivedData" | |
| # Directories to remove (relative to each project) | |
| TARGET_DIRS = { | |
| "Build/Intermediates.noindex", | |
| "Index.noindex", | |
| "Logs", | |
| } | |
| def remove_dir(path: Path): | |
| if path.exists(): | |
| print(f"Removing: {path}") | |
| shutil.rmtree(path, ignore_errors=True) | |
| def clean_project(project_path: Path): | |
| for rel in TARGET_DIRS: | |
| target = project_path / rel | |
| remove_dir(target) | |
| def main(): | |
| if not DERIVED_DATA.exists(): | |
| print("DerivedData directory not found.") | |
| return | |
| for project in DERIVED_DATA.iterdir(): | |
| if project.is_dir(): | |
| clean_project(project) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment