The open-source Mac cleaner, optimizer, and malware scanner.
A feature-complete, free alternative to CleanMyMac — built with Swift 6 and SwiftUI.
Install in one command:
brew tap iliyami/macclean && brew install --cask mac-cleanOr grab the latest DMG from Releases.
Mac Clean is a free, open-source macOS app that cleans junk files, removes malware, optimizes performance, uninstalls apps completely, and visualizes disk usage — all from a single, beautiful interface. It replicates every major feature of CleanMyMac while being fully transparent and community-driven.
No subscriptions. No telemetry. No ads. Just a clean Mac.
| Mac Clean | CleanMyMac | Pearcleaner | PureMac | OnyX | |
|---|---|---|---|---|---|
| Price | Free | $39.95/yr | Free | Free | Free |
| Open source | ✅ BSD-3 | ❌ | ✅ Fair-code | ✅ MIT | ❌ |
| Telemetry | ❌ None | ❌ None | ❌ None | ❌ None | |
| Smart Scan (one-click) | ✅ | ✅ | ❌ | ➖ Partial | ❌ |
| System Junk (16 categories) | ✅ | ✅ | ➖ | ✅ | ➖ Limited |
| Malware scanner | ✅ | ✅ | ❌ | ❌ | ❌ |
| Browser privacy cleaner | ✅ | ✅ | ❌ | ❌ | ➖ |
| Uninstaller with leftover detection | ✅ 10-level | ✅ | ✅ Focus | ❌ | ❌ |
| Disk treemap visualizer | ✅ | ❌ | ❌ | ❌ | ❌ |
| Duplicate finder | ✅ | ✅ | ❌ | ❌ | ❌ |
| Menu bar system monitor | ✅ | ✅ Menu | ❌ | ❌ | ❌ |
| Maintenance scripts | ✅ | ✅ | ❌ | ❌ | ✅ Strong |
| Notarized by Apple | ❌ | ✅ | ✅ | ✅ | ✅ |
| macOS version | 14+ | 13+ | 13+ | 13+ | varies |
CleanMyMac is a great product — they deserve the revenue from users who want a polished, supported experience. Mac Clean is for everyone who'd rather have transparent source code and zero subscription.
| Module | Description |
|---|---|
| Smart Scan | One-click scan combining cleanup, protection, and performance analysis with live progress across 13 modules |
| System Junk | 16 scan categories — user/system caches, logs, language files, broken preferences, broken login items, document versions, iOS backups, Xcode junk, universal binaries, deleted users, and more |
| Mail Attachments | Find cached attachments from Apple Mail, Outlook, and Spark |
| Trash Bins | Empty trash from all locations including external drives |
| Module | Description |
|---|---|
| Malware Removal | Signature-based scanning with 3 depths (Quick / Balanced / Deep), checks launch agents/daemons, browser extensions, and known malware patterns |
| Privacy | Clean Safari, Chrome, and Firefox data — history, cookies, cache. System traces cleanup with time filters |
| Module | Description |
|---|---|
| Optimization | Manage login items and launch agents with enable/disable toggles |
| Maintenance | 10 system tasks — free RAM, run maintenance scripts, repair permissions, rebuild Launch Services, reindex Spotlight, flush DNS, thin Time Machine snapshots |
| Module | Description |
|---|---|
| Uninstaller | 10-level app matching engine that finds every associated file across 17+ Library subdirectories. Complete removal, app reset, unused app detection |
| Updater | Check for available updates across installed apps via Sparkle appcast feeds |
| Module | Description |
|---|---|
| Space Lens | Squarified treemap visualization of disk usage with drill-down navigation |
| Large & Old Files | Find files >50 MB sorted by size and last access date |
| Duplicates | Progressive detection — size grouping → partial SHA-256 (4KB) → full hash → inode verification |
| Shredder | Secure file erasure with standard, permanent, and secure overwrite modes |
Independent menu bar app with real-time system stats:
- CPU load via
host_processor_info(Mach API) - Memory pressure via
vm_statistics64 - Disk usage and health
- Battery charge, health, cycle count, temperature
- Network throughput via
getifaddrs
Mac Clean
├── MacClean — Main SwiftUI app (14 modules, 15 views)
├── MacCleanKit — Shared framework (models, constants, protocols)
├── MacCleanHelper — XPC privileged helper (LaunchDaemon for root ops)
├── MacCleanMenu — Menu bar monitor (independent process)
└── MacCleanTestRunner — Standalone test suite (56 tests)
| Layer | Technology |
|---|---|
| Language | Swift 6 with strict concurrency |
| UI | SwiftUI + AppKit hybrid |
| Concurrency | Actors, TaskGroup, async/await, @Sendable |
| Database | GRDB.swift (SQLite) with WAL mode |
| File Scanning | URLResourceKey prefetching on APFS |
| Incremental Updates | FSEvents with historical replay |
| Privileged Ops | SMAppService + NSXPCConnection |
| System Stats | Mach APIs (host_processor_info, vm_statistics64, proc_pidinfo) |
Mac Clean is designed to never cause data loss:
- Protected paths blocklist —
/System,/usr,/bin,/sbin, Apple system apps are untouchable - Trash-first deletion — all removals go to Trash by default
- Dry-run mode — preview what would be deleted without touching anything
- TOCTOU prevention — symlinks re-resolved immediately before deletion
- 10,000 file cap — prevents runaway deletion operations
- Orphan safety policy — orphan cleanup restricted to caches/logs only
- Operation logging — every action logged to
~/Library/Logs/MacClean/
brew tap iliyami/macclean
brew install --cask mac-cleanThe Cask automatically handles Gatekeeper for you. Launch from Spotlight or Applications — no warnings, no right-clicks, no commands.
curl -fsSL https://raw.githubusercontent.com/iliyami/MacClean/main/scripts/install.sh | bashThis downloads the latest DMG, installs the app to /Applications, and removes the quarantine flag automatically.
Download the latest DMG from Releases and drag Mac Clean to your Applications folder. On first launch, either right-click the app and choose Open, or run once:
sudo xattr -dr com.apple.quarantine "/Applications/Mac Clean.app"git clone https://github.com/iliyami/MacClean.git
cd MacClean
swift build
swift run MacCleanTestRunner # run 56 tests
bash scripts/build-dmg.sh # build local DMGSome modules (Mail Attachments, Privacy, Malware) need Full Disk Access to scan protected areas:
- Open System Settings → Privacy & Security → Full Disk Access
- Click + and add Mac Clean.app from Applications
- Restart Mac Clean
Apple charges $99/year for a Developer ID — the only way to bypass Gatekeeper warnings on macOS. Mac Clean is free, open-source, and built by volunteers. Paying Apple's annual gatekeeping tax just so users can open the app without a warning isn't worth it when:
- The source is right here for you to read
- Homebrew install handles it automatically —
brew install --cask mac-cleanand you're done - The one-line installer handles it automatically
- The whole "Gatekeeper warning" thing is just an extra
xattrcommand for direct DMG installs
If our community ever wants to fund a Developer ID (or some other open-source organization wants to sponsor one), we'll happily ship notarized builds. Until then, no paywall just to launch a free app.
For maintainers with a Developer ID who want to ship notarized builds:
export APPLE_DEVELOPER_ID='Developer ID Application: Your Name (TEAMID)'
xcrun notarytool store-credentials 'MacClean' --apple-id YOU@example.com --team-id TEAMID
export NOTARY_PROFILE='MacClean'
bash scripts/build-dmg.sh --notarize- macOS 14 (Sonoma) or later
- For building from source: Swift 6 toolchain (Xcode 16+)
Sources/
├── MacClean/
│ ├── App/ # App entry point, state, content view
│ ├── Core/
│ │ ├── Scanner/ # FileTreeScanner, TargetedScanner, ScanCoordinator
│ │ ├── Cleaner/ # CleaningEngine, SafetyGuard
│ │ ├── Cache/ # GRDB database layer
│ │ └── FSMonitor/ # FSEvents incremental watcher
│ ├── Modules/ # 13 scan modules
│ │ ├── SystemJunk/ # 16 junk categories
│ │ ├── Malware/ # Signature scanner + real-time monitor
│ │ ├── Uninstaller/ # 10-level app matching engine
│ │ ├── SpaceLens/ # Squarified treemap algorithm
│ │ ├── Duplicates/ # Progressive hash pipeline
│ │ └── ...
│ ├── Views/ # SwiftUI views (14 module views + shared components)
│ ├── ViewModels/ # @Observable view models
│ ├── Services/ # PermissionManager, XPCClient
│ └── Utilities/ # SuperEllipse shape, extensions
├── MacCleanKit/ # Shared models, constants, protocols
├── MacCleanHelper/ # XPC privileged helper (root operations)
├── MacCleanMenu/ # Menu bar system monitor
└── MacCleanTestRunner/ # 56 standalone tests
swift testXCTest-based suite covering:
SafetyGuard— 24 adversarial tests (symlinks, traversal, NULL bytes, SIP, protected apps, file caps, idempotence)CleaningEngine— 9 integration tests (dry-run, trash, permanent, error handling, operation log)PlistJunkFilter— 9 tests including Apple-system-domain safety contractScanCoordinatorstate machine — scan/cancel/category-filter/include-heavyTargetedScannerintegration — runs against synthetic temp directory fixtures- All 16 system junk categories — pure target declarations + the filter logic on the procedural ones (
BrokenPreferences,BrokenLoginItems,UniversalBinaries,DeletedUsers) SquarifiedTreemap— empty, single, multi-node, area conservation, aspect-ratio propertiesAppMatching— all 10 levels of the uninstaller pattern engineDuplicateDetection— size groups, partial/full hash groups, inode dedupMalwareSignatures— name patterns + suspicious launch agent payloadsMaintenanceTask— all 10 tasks have descriptions, icons, executable pathsFileGroup— by-size / by-type / by-age groupingAppcastParser— Sparkle XML parsingVolumeInfo— usage math, equalityAppDatabase— GRDB cache CRUD, migrations, invalidationFSEventMonitor— invalidated-path computationAppDiscovery,AppPathFinder— smoke tests- End-to-end — synthetic fixture → scan → results → clean cycle
Test infrastructure (Tests/MacCleanTestSupport/) provides withTempHome, withFakeApp, withFakePlist, and other fixture helpers so tests stay deterministic and never touch the user's real home.
Coverage target: 85%+ overall, 100% on SafetyGuard and CleaningEngine (the death-and-life files). See docs/TESTING.md for the full roadmap.
Mac Clean takes security seriously:
- No network access — the app never phones home, no telemetry, no analytics
- No elevated privileges by default — XPC helper only activated for maintenance tasks
- Code signature verification — XPC helper validates caller identity
- Protected paths — 27+ Apple system apps and all SIP-protected paths are blocklisted
- Open source — every line of code is auditable
- No command injection vectors (all Process args are hardcoded constants)
- No arbitrary file deletion (SafetyGuard validates every path)
- TOCTOU race condition prevention (symlink re-resolution before delete)
- File operation caps (10,000 file limit per operation)
- XPC caller validation (code signature check)
- No secrets or credentials in source
- Trash-first policy (recoverable by default)
- Operation audit log (every action recorded)
We welcome contributions! Please read our Contributing Guidelines before submitting a PR.
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
swift run MacCleanTestRunner) - Commit (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the BSD 3-Clause License — see the LICENSE file for details.
This means you can use, modify, and redistribute this code, but you must:
- Include the original copyright notice
- Include the license text
- Not use the name "Mac Clean" or contributors' names to endorse derived products without permission
Inspired by the open-source Mac utility community:
- Pearcleaner — app uninstaller patterns
- Mole — cleanup categories
- Tencent Lemon Cleaner — modular architecture
- Squarified Treemap algorithm by Bruls, Huizing & van Wijk (2000)
Mac Clean is free software built by the community, for the community.
If you find it useful, please star the repo and share it with others.
