The verdict: can you vibe code Hazel?
Build a simplified folder-watch script yourself for free, but replicating a robust native macOS utility with a graphical rule builder and App Sweep takes weeks of systems programming.
Hazel's value is not a complex UI; it's bulletproof, silent background reliability on macOS. Writing a native macOS app in Swift/SwiftUI using the `FSEvents` API is entirely achievable with an AI coding agent like Claude Code, but handling partial file downloads, Spotlight metadata parsing edge cases, and macOS permission prompts will cause significant friction. Since Hazel costs $42 once and has been refined over 20 years, buying it is the rational choice unless you want a deep dive into macOS systems programming.
Estimated effort: 3-4 weeks of focused systems development
What you can't replicate
- 20 years of battle-tested edge case handling for macOS file system changes
- Frictionless sandboxing and permission management across macOS versions
Founded
2006
Raised
—
Team
1 human, 1 dog
Cheapest paid tier
$42.00
What Hazel does
A premier file-organization and automation utility designed exclusively for macOS that watches folders and executes user-defined rules to sort, rename, tag, move, copy, archive, or delete files.
Core features
- Directory monitoring using macOS FSEvents
- Nested rule engine (if all/any conditions match)
- File metadata and content extraction (Spotlight, PDF text layers)
- File actions: move, copy, rename patterns, tag, script execution
- App Sweep (trash monitoring and orphaned file clean-up)
- Trash management policies (auto-delete aged/oversized items)
The business
Pricing
- Single User License$42.00
- Family Pack License$65.00
Funding
Unknown / bootstrapped
Pay vs build, cumulative
Break-even at month 1 — after that, every month is money kept.
The hard parts of vibe coding Hazel
- Low-level FSEvents monitoring that survives sleep/wake cycles and avoids CPU spikes during rapid bursts
- Partial write handling (detecting when large file downloads are complete before processing)
- Deep macOS sandbox and permissions handling (Full Disk Access entitlements)
- App Sweep heuristic scanning to identify orphaned app support and plist files safely
How to vibecode Hazel
Prerequisites
Macexisting hardware
Required to build and run native macOS applications
Xcodefree
Apple's IDE for compiling Swift and SwiftUI native applications
GitHubfree
Source control repository hosting
AI coding tools
Recommended stack
| Frontend | SwiftUI (Native macOS) |
|---|---|
| Backend | Swift (CoreFoundation, FSEvents, FileManager) |
| Database | SwiftData / SQLite (local rule storage) |
| Auth | None (local utility) |
| Payments | None (personal clone) |
| Other | OSAKit (AppleScript integration), UniformTypeIdentifiers |
Hosting & infrastructure
| None — runs locally | Native macOS application executes locally on user machine | $0/mo |
Build guide
01Project Scaffolding & Architecture
Initialize a native macOS application project in Swift and SwiftUI, setting up clean architecture separation between UI, rule definitions, and the background file monitoring engine.
Create a new Swift Package or Xcode project structure for a native macOS menu bar utility named 'MacRuleEngine'. Use Swift 6 and SwiftUI. Establish a modular architecture with targets/folders for: Models (Rule, Condition, Action), Engine (FileWatcher, RuleEvaluator, FileOperations), and UI (SettingsView, RuleEditorView, StatusMenu). Configure the app as a background agent (LSUIElement = true in Info.plist) with a menu bar item. Ensure all file operations use modern Swift async/await patterns and proper error handling with custom error types. Write a set of unit tests for the Rule data model and JSON persistence layer to verify round-trip serialization.02Low-Level Directory Monitoring (FSEvents)
Implement robust directory monitoring using macOS FSEvents API to detect file creation, modification, and deletion events without CPU pinning.
Implement a high-performance directory watcher in Swift using the macOS FSEvents C API or DispatchSource. The watcher must accept a list of folder bookmarks (scoped security bookmarks for sandboxing) and stream file system events asynchronously. Implement debouncing logic to handle rapid file creation bursts (e.g., large file downloads writing chunks) so rules only trigger once the file size stabilizes. Handle system sleep/wake notifications to restart or re-establish event streams gracefully. Log all raw events to a local rotating log file for debugging purposes.03Rule Evaluation Engine
Build a recursive rule engine that evaluates file attributes (name, extension, date, size, Spotlight metadata) against user-defined conditions (All/Any of the following match).
Build a robust rule evaluation engine in Swift. A Rule consists of a matching mode (.all or .any), an array of Conditions (attribute, operator, value), and an array of Actions. Support attributes: file name, extension, date added, date modified, file size, and Spotlight metadata attributes. Support operators: contains, equals, begins with, ends with, is greater than, matches regex. Implement a dry-run mode that evaluates a file against a rule and returns a detailed trace of which conditions passed or failed. Ensure thread-safe evaluation when multiple file events arrive concurrently.04File Action Execution & Safety
Execute automated actions on matching files (move, copy, rename with pattern tokens, tag, trash) with built-in conflict resolution.
Implement the action executor in Swift for file manipulation: move to folder, copy to folder, rename using tokens (e.g., date, original name, sequence), add Finder tags, run shell scripts, run AppleScripts, and move to trash. Handle file name collisions safely by appending numeric suffixes (e.g., 'report (1).pdf') instead of overwriting existing files. Use NSFileCoordinator and file coordination APIs to prevent race conditions with other running applications accessing the same files. Include comprehensive error handling for permission denied or disk full scenarios.05Graphical Rule Editor UI
Create a responsive SwiftUI preferences interface allowing users to configure watched folders, build nested rules, and view execution history.
Design and implement a native macOS settings window in SwiftUI for managing watched folders and rules. The interface should feature a sidebar for folders, a central list of rules with drag-and-drop reordering, and an interactive rule editor sheet supporting nested conditions and action configurations with token substitution pickers. Include a live activity/history tab showing a chronological log of recently triggered rules, matched files, and action results with undo options where feasible. Ensure the UI conforms to Apple's Human Interface Guidelines for macOS settings panes.06App Sweep & Trash Management
Implement trash monitoring to detect when applications are moved to the Trash and locate orphaned support files, preferences, and caches.
Implement an 'App Sweep' subsystem in Swift that monitors the user's ~/.Trash directory or listens to Finder trash notifications. When an application (.app bundle) is placed in the trash, parse its bundle identifier (from Info.plist) and bundle name. Scan standard macOS system locations (~/Library/Preferences, ~/Library/Application Support, ~/Library/Caches, ~/Library/Logs) for files and folders matching the bundle identifier or app name. Present a native NSAlert or custom SwiftUI confirmation panel to the user listing discovered orphaned files and offering to delete them alongside the application.07Permissions, Sandboxing & Polish
Handle macOS permissions (Full Disk Access, security-scoped bookmarks) and package the application for local distribution.
Implement security-scoped bookmark handling in Swift so folder permissions persist across app relaunches. Add a permissions onboarding wizard that checks for Full Disk Access and accessibility privileges, providing clear user guidance and deep links into System Settings. Configure app entitlements, hardened runtime, and code signing parameters for local distribution. Build an automated release script using xcodebuild to archive, export, and package the app into a DMG installer.
Cost vs paying for Hazel
What will you build it with?
Starting total with Claude Code$0 one-time
Starting costs (one-time)
- AI Coding Assistant (Claude Pro)$20
Total~$20 one-time
Ongoing costs (monthly)
Total$0/mo
Paying for Hazel
$42.00 one-time
Your time to build
40-60 hours
AI tool credits
$20
Break-even
N/A (Perpetual software license)
Vibe code Hazel: FAQ
- Can you vibe code Hazel yourself?
- Serious undertaking — 45/100 vibecodeable. Build a simplified folder-watch script yourself for free, but replicating a robust native macOS utility with a graphical rule builder and App Sweep takes weeks of systems programming.
- How long does it take to vibe code Hazel?
- 3-4 weeks of focused systems development — roughly 40-60 hours of hands-on time with an AI coding agent.
- How do you build your own Hazel?
- Scoped to personal use: SwiftUI (Native macOS) on the front, Swift (CoreFoundation, FSEvents, FileManager) behind it, SwiftData / SQLite (local rule storage) for data. Follow the 7-step build guide on this page — each step has a paste-ready prompt for an AI coding agent.
- How do you code your own Hazel without being an expert?
- Use an AI coding tool (Claude Code or Cursor) and work in small steps: scaffold, data model, core screens, then deploy. Realistic effort: 3-4 weeks of focused systems development. The prompts on this page are written so the AI does the heavy lifting.
- How much does it cost to vibe code Hazel instead of paying?
- About ~$20 one-time to start and $0/mo to run, versus $42.00 one-time for Hazel. Break-even: N/A (Perpetual software license).
- What stack should you use to vibe code Hazel?
- SwiftUI (Native macOS); Swift (CoreFoundation, FSEvents, FileManager); SwiftData / SQLite (local rule storage); plus OSAKit (AppleScript integration), UniformTypeIdentifiers.