# OrphanCleaner

A native macOS app for cleaning up your system — find orphaned files, duplicates, space hogs, and security threats. No subscriptions, no bloatware, no phoning home.

Built as a single Swift file with zero dependencies. Matches the style of [EvidenceHeat](https://evidenceheat.candylandconsulting.com).

## Tabs

### Orphans
Find leftover files from apps you've already uninstalled. Scans ~/Library for abandoned caches, preferences, containers, launch agents, and app support folders.
- Safety ratings: Safe (green), Probably Safe (orange), Review First (red)
- Filter by safety level, search by name
- Move selected to Trash or mark as safe (persistent)

### Cleanup
Find reclaimable disk space across your system.
- **Large Files** — files >100MB in Downloads, Documents, Desktop, Movies, Music, Pictures
- **Old Downloads** — files in ~/Downloads older than 30 days
- **Dev Caches** — Xcode DerivedData, simulators, CocoaPods, npm, pip, Yarn, Gradle, Cargo
- **Homebrew** — old formula versions and cache

### Duplicates
Hash-based duplicate file detection across ~/Downloads and ~/Documents.
- Groups all copies together so you can pick which to keep
- Each copy shows Keep (green) or Delete (red) status
- Reveal any copy in Finder to compare before deciding
- Size-first algorithm — only hashes files that share the same size, so it's fast

### Disk Usage
Sunburst chart visualization of disk space (similar to DaisyDisk).
- Concentric rings — inner = top-level folders, outer = deeper
- Center shows total size
- Hover to see info, double-click to drill into a directory
- Right panel shows folder breakdown with sizes
- Dark background, color-coded segments

### Security
Scan for threats, suspicious persistence mechanisms, and privacy concerns.
- **LaunchAgents/Daemons** — flags unknown or unsigned entries
- **Login Items** — unexpected background tasks
- **Known Malware Paths** — checks ~30 known macOS malware/adware locations
- **Unsigned Binaries** — finds unsigned executables in suspicious locations
- **Browser Extensions** — deep permission analysis for Chrome, Safari, Firefox
- **Open Ports** — what's listening on your network
- **SSH Keys** — weak keys, too-open permissions, authorized_keys audit
- **Shell Profiles** — scans .zshrc/.bash_profile for suspicious patterns
- **Cron Jobs** — unexpected scheduled tasks
- **Privacy Permissions** — which apps have camera, mic, screen recording, full disk access, accessibility, etc.

## Mark as Safe
All tabs support "Mark Safe" — selected items are saved to `~/Library/Application Support/OrphanCleaner/safelist.json` and won't appear on future scans.

## Build

Requires Xcode Command Line Tools.

```bash
swiftc main.swift -o OrphanCleaner -framework AppKit -framework SwiftUI -parse-as-library
```

Source code is inside the app bundle at `OrphanCleaner.app/Contents/Resources/Source/main.swift`.

## License

MIT — See [LICENSE](LICENSE)
