What Application Data Does Mole's Uninstaller Remove? Complete Technical Breakdown
Mole's uninstaller removes every trace of macOS applications including user caches, preferences, Application Support files, system-level LaunchAgents, Launch Services registrations, Dock icons, and Homebrew cask artifacts while strictly validating paths to prevent system damage.
Mole is an open-source macOS application management tool that provides comprehensive uninstall capabilities. When you need to know what application data does Mole's uninstaller remove, the answer spans both user-level directories and system-wide frameworks, ensuring complete cleanup of residual files that standard macOS uninstallation leaves behind.
User-Level Application Data
Mole targets every user-specific directory where macOS applications store data. In lib/core/app_protection.sh, the find_app_files() function scans approximately 30 distinct locations to identify application artifacts.
Standard macOS Directories
The uninstaller removes files from these user library locations:
~/Library/Application Support/<AppName>/~/Library/Caches/<BundleID>/~/Library/Logs/<AppName>/~/Library/Saved Application State/<BundleID>.savedState/~/Library/Containers/<BundleID>/~/Library/WebKit/<BundleID>/~/Library/HTTPStorages/<BundleID>/~/Library/Cookies/<BundleID>.binarycookies~/Library/LaunchAgents/(matching plist files)~/Library/Application Scripts/<BundleID>/~/Library/Services/~/Library/QuickLook/~/Library/Audio/Plug-Ins/~/Library/PreferencePanes/~/Library/Input Methods/~/Library/Screen Savers/~/Library/Frameworks/~/Library/Autosave Information/~/Library/Contextual Menu Items/~/Library/Spotlight/~/Library/ColorPickers/~/Library/Workflows/
Cross-Platform Configuration Files
Mole also cleans Unix-style configuration directories that many cross-platform apps utilize:
~/.config/<AppName>/~/.local/share/<AppName>/- Hidden dot-files in the home directory matching the app name or bundle ID
System-Level Files
For applications that install global components, Mole's find_app_system_files() function in lib/core/app_protection.sh (lines 1240-1248) targets system-wide directories.
Global Library Locations
The uninstaller removes files from these system library paths when they match the target application:
/Library/Application Support/<AppName>//Library/LaunchAgents/(system-wide user agents)/Library/LaunchDaemons/(system services)/Library/Preferences/(global preferences)/Library/Receipts/(installer receipts)/Library/Frameworks//Library/Internet Plug-Ins//Library/Input Methods//Library/Audio/Plug-Ins//Library/QuickLook//Library/PreferencePanes//Library/Screen Savers//Library/Caches/
Runtime and Service Registrations
Beyond static files, Mole scrubs live system registrations that persist after an app is deleted from disk.
Launch Services Database
In lib/uninstall/batch.sh, the unregister_app_bundle() function (lines 22-31) removes the app's entry from the Launch Services database. This eliminates the app from the "Open With" menu and removes stale Spotlight references.
Launch Agents and Daemons
The stop_launch_services() function (lines 84-90) unloads matching plist files from launchctl before deleting them, preventing "file not found" errors in system logs and ensuring background processes terminate cleanly.
Login Items and Dock
Mole removes the app from the user's Login Items via remove_login_item() (lines 71-78) and cleans stale icons from the Dock using remove_apps_from_dock() in lib/core/common.sh (lines 44-78).
Preference Domains
The uninstaller deletes the app's defaults domains (including ByHost variants) to remove all NSUserDefaults entries and cached preferences.
Homebrew Cask Integration
For apps installed via Homebrew, Mole delegates to brew uninstall --cask --zap through the brew_uninstall_cask() function in lib/uninstall/brew.sh (lines 79-97). This ensures Homebrew's metadata, download caches, and associated caveats are cleaned alongside the application bundle, providing a more thorough removal than simple file deletion alone.
Safety and Validation Mechanisms
Mole implements path validation to prevent accidental deletion of system files. The validate_path_for_deletion() helper in lib/core/app_protection.sh blocks paths matching /System/*, /usr/*, /private/*, and other protected locations. All deletions flow through safe_remove and safe_sudo_remove wrappers that verify file ownership and bundle ID matches before execution.
Practical Usage Examples
Interactive Uninstall
Launch the TUI to select apps visually:
mo uninstall
Preview Before Deletion
Use dry-run mode to see exactly what application data Mole's uninstaller would remove without actually deleting anything:
mo uninstall --dry-run
Uninstall Specific Paths
Target an app directly by path:
mo uninstall /Applications/SomeApp.app
Batch Uninstall via Script
Programmatically remove multiple apps matching a pattern:
#!/usr/bin/env bash
apps=$(mo list --json | jq -r '.[] | select(.name|contains("Chrome")) | .path')
for app in $apps; do
mo uninstall "$app"
done
Summary
- Mole's uninstaller removes user-level files from
~/Library/subdirectories including Caches, Preferences, Application Support, and Containers. - It cleans system-level files from
/Library/including LaunchDaemons, LaunchAgents, and global Frameworks. - It unregisters Launch Services entries, removes Login Items, clears Dock icons, and stops running launchctl services.
- For Homebrew Cask installations, it invokes
brew uninstall --cask --zapfor complete metadata cleanup. - All operations include path validation to protect system directories and provide dry-run capability for safe preview.
Frequently Asked Questions
Does Mole's uninstaller remove system files or only user data?
Mole removes both user and system files, but only those specifically associated with the target application. The find_app_system_files() function in lib/core/app_protection.sh targets system-wide directories like /Library/LaunchDaemons and /Library/Frameworks, while strict validation prevents deletion of critical OS paths like /System or /usr.
Is it safe to use Mole's uninstaller on system applications?
No, Mole explicitly blocks the uninstallation of system applications. The validate_path_for_deletion() helper and related safety functions in lib/core/app_protection.sh reject paths matching /System/*, /usr/*, and other protected locations. This prevents accidental removal of macOS components while allowing thorough cleaning of third-party apps.
Can I preview what files will be deleted before running the uninstaller?
Yes, Mole provides a dry-run mode via the --dry-run flag. When invoked as mo uninstall --dry-run, the tool executes the full discovery logic—including find_app_files() and find_app_system_files()—but replaces all deletion operations with debug logs. The final output includes a summary of prospective disk space reclamation without modifying any files.
Does Mole handle Homebrew Cask installations differently from regular apps?
Yes, Mole detects Homebrew Cask installations and delegates to brew uninstall --cask --zap through the brew_uninstall_cask() function in lib/uninstall/brew.sh. This ensures that Homebrew's metadata, download caches, and associated caveats are cleaned alongside the application bundle, providing a more thorough removal than simple file deletion alone.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →