1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-13 01:35:15 +00:00

apps missing from uninstall list

This commit is contained in:
Tw93
2025-10-04 08:54:52 +08:00
parent eb7cbb8e10
commit 511c77b3c4
3 changed files with 141 additions and 42 deletions

View File

@@ -16,7 +16,7 @@
## Highlights ## Highlights
- 🐦 **Deep System Cleanup** - Remove hidden caches, logs, and temp files in one sweep - 🐦 **Deep System Cleanup** - Remove hidden caches, logs, and temp files in one sweep
- 📦 **Thorough Uninstall** - Removes more app leftovers than CleanMyMac/Lemon, completely free - 📦 **Thorough Uninstall** - 22+ locations cleaned vs 1 standard, beats CleanMyMac/Lemon
- ⚡️ **Fast & Lightweight** - Terminal-based, zero bloat, arrow-key navigation with pagination - ⚡️ **Fast & Lightweight** - Terminal-based, zero bloat, arrow-key navigation with pagination
- 🧹 **Massive Space Recovery** - Reclaim 100GB+ of wasted disk space - 🧹 **Massive Space Recovery** - Reclaim 100GB+ of wasted disk space
@@ -96,11 +96,11 @@ Select Apps to Remove
🗑️ Uninstalling: Adobe Creative Cloud 🗑️ Uninstalling: Adobe Creative Cloud
✓ Removed application ✓ Removed application
✓ Cleaned 45 related files ✓ Cleaned 52 related files
==================================================================== ====================================================================
🎉 UNINSTALLATION COMPLETE! 🎉 UNINSTALLATION COMPLETE!
🗑️ Apps uninstalled: 1 | Space freed: 12.4GB 🗑️ Apps uninstalled: 1 | Space freed: 12.8GB
==================================================================== ====================================================================
``` ```
@@ -108,10 +108,14 @@ Select Apps to Remove
| Category | Targets | Typical Recovery | | Category | Targets | Typical Recovery |
|----------|---------|------------------| |----------|---------|------------------|
| **System** | App caches, logs, trash, crash reports | 20-50GB | | **System** | App caches, logs, trash, crash reports, Spotlight cache | 20-50GB |
| **Browsers** | Safari, Chrome, Edge, Arc, Firefox cache | 5-15GB | | **Browsers** | Safari, Chrome, Edge, Arc, Firefox, Brave cache | 5-15GB |
| **Developer** | npm, pip, Docker, Homebrew, Xcode | 15-40GB | | **Developer** | npm, pip, Docker, Homebrew, Xcode, Android Studio | 15-40GB |
| **Apps** | Slack, Discord, Teams, Notion cache | 3-10GB | | **Cloud Storage** | Dropbox, Google Drive, OneDrive, Baidu Netdisk cache | 5-20GB |
| **Office Apps** | Microsoft Office, iWork, WPS Office cache | 2-8GB |
| **Media Apps** | Spotify, Music, VLC, IINA, video players cache | 3-12GB |
| **Communication** | Slack, Discord, Teams, WeChat, Zoom cache | 3-10GB |
| **Virtualization** | VMware, Parallels, VirtualBox, Vagrant cache | 5-15GB |
**Protect Important Files:** Create `~/.config/mole/whitelist` to preserve critical caches: **Protect Important Files:** Create `~/.config/mole/whitelist` to preserve critical caches:
@@ -125,14 +129,13 @@ echo '~/Library/Caches/ms-playwright*' >> ~/.config/mole/whitelist
## What Mole Uninstalls ## What Mole Uninstalls
| Component | Files Removed | Examples | | Category | What Gets Removed | Locations |
|-----------|--------------|----------| |----------|------------------|-----------|
| **App Bundle** | Main .app executable | `/Applications/App.app` | | **App Bundle** | Main application executable | `/Applications/` |
| **Support Data** | App-specific user data | `~/Library/Application Support/AppName` | | **User Data** | Support files, caches, preferences, logs, containers, saved states | `~/Library/` (12 locations) |
| **Cache Files** | Temporary & cache data | `~/Library/Caches/com.company.app` | | **Web Data** | WebKit storage, HTTP storage, cookies | `~/Library/WebKit/`, `~/Library/HTTPStorages/` |
| **Preferences** | Settings & config files | `~/Library/Preferences/com.app.plist` | | **Extensions** | Plugins, scripts, services, frameworks, QuickLook generators | `~/Library/Internet Plug-Ins/`, `~/Library/Services/` |
| **Logs & Reports** | Crash reports & logs | `~/Library/Logs/AppName` | | **System** | Launch daemons, helper tools, system preferences, install receipts | `/Library/`, `/var/db/receipts/` (requires sudo) |
| **Containers** | Sandboxed app data | `~/Library/Containers/com.app.id` |
## FAQ ## FAQ

View File

@@ -223,10 +223,9 @@ load_config
# App Management Functions # App Management Functions
# ============================================================================ # ============================================================================
# Essential system and critical app patterns that should never be removed # System critical components that should NEVER be uninstalled
readonly PRESERVED_BUNDLE_PATTERNS=( readonly SYSTEM_CRITICAL_BUNDLES=(
# System essentials "com.apple.*" # System essentials
"com.apple.*"
"loginwindow" "loginwindow"
"dock" "dock"
"systempreferences" "systempreferences"
@@ -252,9 +251,7 @@ readonly PRESERVED_BUNDLE_PATTERNS=(
"KeyLayout*" "KeyLayout*"
"GlobalPreferences" "GlobalPreferences"
".GlobalPreferences" ".GlobalPreferences"
# Input methods (critical for international users) # Input methods (critical for international users)
# Specific input method bundles
"com.tencent.inputmethod.QQInput" "com.tencent.inputmethod.QQInput"
"com.sogou.inputmethod.*" "com.sogou.inputmethod.*"
"com.baidu.inputmethod.*" "com.baidu.inputmethod.*"
@@ -262,17 +259,17 @@ readonly PRESERVED_BUNDLE_PATTERNS=(
"com.googlecode.rimeime.*" "com.googlecode.rimeime.*"
"im.rime.*" "im.rime.*"
"org.pqrs.Karabiner*" "org.pqrs.Karabiner*"
# Generic patterns (more conservative)
"*.inputmethod" "*.inputmethod"
"*.InputMethod" "*.InputMethod"
"*IME" "*IME"
# Keep system input services safe
"com.apple.inputsource*" "com.apple.inputsource*"
"com.apple.TextInputMenuAgent" "com.apple.TextInputMenuAgent"
"com.apple.TextInputSwitcher" "com.apple.TextInputSwitcher"
)
# Cleanup and system tools (avoid infinite loops and preserve licenses) # Apps with important data/licenses - protect during cleanup but allow uninstall
"com.nektony.*" # App Cleaner & Uninstaller readonly DATA_PROTECTED_BUNDLES=(
"com.nektony.*" # App Cleaner & Uninstaller (cleanup tools)
"com.macpaw.*" # CleanMyMac, CleanMaster "com.macpaw.*" # CleanMyMac, CleanMaster
"com.freemacsoft.AppCleaner" # AppCleaner "com.freemacsoft.AppCleaner" # AppCleaner
"com.omnigroup.omnidisksweeper" # OmniDiskSweeper "com.omnigroup.omnidisksweeper" # OmniDiskSweeper
@@ -283,34 +280,26 @@ readonly PRESERVED_BUNDLE_PATTERNS=(
"com.CharlesProxy.*" # Charles Proxy (paid) "com.CharlesProxy.*" # Charles Proxy (paid)
"com.proxyman.*" # Proxyman (paid) "com.proxyman.*" # Proxyman (paid)
"com.getpaw.*" # Paw (paid) "com.getpaw.*" # Paw (paid)
"com.1password.*" # 1Password (security apps)
# Security and password managers (critical data)
"com.1password.*" # 1Password
"com.agilebits.*" # 1Password legacy "com.agilebits.*" # 1Password legacy
"com.lastpass.*" # LastPass "com.lastpass.*" # LastPass
"com.dashlane.*" # Dashlane "com.dashlane.*" # Dashlane
"com.bitwarden.*" # Bitwarden "com.bitwarden.*" # Bitwarden
"com.keepassx.*" # KeePassXC "com.keepassx.*" # KeePassXC
"com.jetbrains.*" # JetBrains IDEs (dev tools)
# Development tools (licenses and settings)
"com.jetbrains.*" # JetBrains IDEs (paid licenses)
"com.sublimetext.*" # Sublime Text (paid) "com.sublimetext.*" # Sublime Text (paid)
"com.panic.transmit*" # Transmit (paid) "com.panic.transmit*" # Transmit (paid)
"com.sequelpro.*" # Database tools "com.sequelpro.*" # Database tools
"com.sequel-ace.*" "com.sequel-ace.*"
"com.tinyapp.*" # TablePlus (paid) "com.tinyapp.*" # TablePlus (paid)
"com.adobe.*" # Adobe Creative Suite (design tools)
# Design tools (expensive licenses)
"com.adobe.*" # Adobe Creative Suite
"com.bohemiancoding.*" # Sketch "com.bohemiancoding.*" # Sketch
"com.figma.*" # Figma "com.figma.*" # Figma
"com.framerx.*" # Framer "com.framerx.*" # Framer
"com.zeplin.*" # Zeplin "com.zeplin.*" # Zeplin
"com.invisionapp.*" # InVision "com.invisionapp.*" # InVision
"com.principle.*" # Principle "com.principle.*" # Principle
"com.omnigroup.*" # OmniFocus, OmniGraffle (productivity)
# Productivity (important data and licenses)
"com.omnigroup.*" # OmniFocus, OmniGraffle, etc.
"com.culturedcode.*" # Things "com.culturedcode.*" # Things
"com.todoist.*" # Todoist "com.todoist.*" # Todoist
"com.bear-writer.*" # Bear "com.bear-writer.*" # Bear
@@ -318,9 +307,7 @@ readonly PRESERVED_BUNDLE_PATTERNS=(
"com.ulyssesapp.*" # Ulysses "com.ulyssesapp.*" # Ulysses
"com.literatureandlatte.*" # Scrivener "com.literatureandlatte.*" # Scrivener
"com.dayoneapp.*" # Day One "com.dayoneapp.*" # Day One
"com.spotify.client" # Spotify (media apps)
# Media and entertainment (licenses)
"com.spotify.client" # Spotify (premium accounts)
"com.apple.FinalCutPro" # Final Cut Pro "com.apple.FinalCutPro" # Final Cut Pro
"com.apple.Motion" # Motion "com.apple.Motion" # Motion
"com.apple.Compressor" # Compressor "com.apple.Compressor" # Compressor
@@ -328,7 +315,9 @@ readonly PRESERVED_BUNDLE_PATTERNS=(
"com.pixelmatorteam.*" # Pixelmator "com.pixelmatorteam.*" # Pixelmator
) )
# Check if bundle should be preserved (system/critical apps) # Legacy function - preserved for backward compatibility
# Use should_protect_from_uninstall() or should_protect_data() instead
readonly PRESERVED_BUNDLE_PATTERNS=("${SYSTEM_CRITICAL_BUNDLES[@]}" "${DATA_PROTECTED_BUNDLES[@]}")
should_preserve_bundle() { should_preserve_bundle() {
local bundle_id="$1" local bundle_id="$1"
for pattern in "${PRESERVED_BUNDLE_PATTERNS[@]}"; do for pattern in "${PRESERVED_BUNDLE_PATTERNS[@]}"; do
@@ -339,21 +328,52 @@ should_preserve_bundle() {
return 1 return 1
} }
# Check if app is a system component that should never be uninstalled
should_protect_from_uninstall() {
local bundle_id="$1"
for pattern in "${SYSTEM_CRITICAL_BUNDLES[@]}"; do
if [[ "$bundle_id" == $pattern ]]; then
return 0
fi
done
return 1
}
# Check if app data should be protected during cleanup (but app can be uninstalled)
should_protect_data() {
local bundle_id="$1"
# Protect both system critical and data protected bundles during cleanup
for pattern in "${SYSTEM_CRITICAL_BUNDLES[@]}" "${DATA_PROTECTED_BUNDLES[@]}"; do
if [[ "$bundle_id" == $pattern ]]; then
return 0
fi
done
return 1
}
# Find and list app-related files (consolidated from duplicates) # Find and list app-related files (consolidated from duplicates)
find_app_files() { find_app_files() {
local bundle_id="$1" local bundle_id="$1"
local app_name="$2" local app_name="$2"
local -a files_to_clean=() local -a files_to_clean=()
# ============================================================================
# User-level files (no sudo required)
# ============================================================================
# Application Support # Application Support
[[ -d ~/Library/Application\ Support/"$app_name" ]] && files_to_clean+=("$HOME/Library/Application Support/$app_name") [[ -d ~/Library/Application\ Support/"$app_name" ]] && files_to_clean+=("$HOME/Library/Application Support/$app_name")
[[ -d ~/Library/Application\ Support/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/Application Support/$bundle_id") [[ -d ~/Library/Application\ Support/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/Application Support/$bundle_id")
# Caches # Caches
[[ -d ~/Library/Caches/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/Caches/$bundle_id") [[ -d ~/Library/Caches/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/Caches/$bundle_id")
[[ -d ~/Library/Caches/"$app_name" ]] && files_to_clean+=("$HOME/Library/Caches/$app_name")
# Preferences # Preferences
[[ -f ~/Library/Preferences/"$bundle_id".plist ]] && files_to_clean+=("$HOME/Library/Preferences/$bundle_id.plist") [[ -f ~/Library/Preferences/"$bundle_id".plist ]] && files_to_clean+=("$HOME/Library/Preferences/$bundle_id.plist")
while IFS= read -r -d '' pref; do
files_to_clean+=("$pref")
done < <(find ~/Library/Preferences/ByHost -name "$bundle_id*.plist" -print0 2>/dev/null)
# Logs # Logs
[[ -d ~/Library/Logs/"$app_name" ]] && files_to_clean+=("$HOME/Library/Logs/$app_name") [[ -d ~/Library/Logs/"$app_name" ]] && files_to_clean+=("$HOME/Library/Logs/$app_name")
@@ -370,12 +390,88 @@ find_app_files() {
files_to_clean+=("$container") files_to_clean+=("$container")
done < <(find ~/Library/Group\ Containers -name "*$bundle_id*" -type d -print0 2>/dev/null) done < <(find ~/Library/Group\ Containers -name "*$bundle_id*" -type d -print0 2>/dev/null)
# WebKit data
[[ -d ~/Library/WebKit/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/WebKit/$bundle_id")
[[ -d ~/Library/WebKit/com.apple.WebKit.WebContent/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/WebKit/com.apple.WebKit.WebContent/$bundle_id")
# HTTP Storage
[[ -d ~/Library/HTTPStorages/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/HTTPStorages/$bundle_id")
# Cookies
[[ -f ~/Library/Cookies/"$bundle_id".binarycookies ]] && files_to_clean+=("$HOME/Library/Cookies/$bundle_id.binarycookies")
# Launch Agents (user-level)
[[ -f ~/Library/LaunchAgents/"$bundle_id".plist ]] && files_to_clean+=("$HOME/Library/LaunchAgents/$bundle_id.plist")
# Application Scripts
[[ -d ~/Library/Application\ Scripts/"$bundle_id" ]] && files_to_clean+=("$HOME/Library/Application Scripts/$bundle_id")
# Services
[[ -d ~/Library/Services/"$app_name".workflow ]] && files_to_clean+=("$HOME/Library/Services/$app_name.workflow")
# Internet Plug-Ins
while IFS= read -r -d '' plugin; do
files_to_clean+=("$plugin")
done < <(find ~/Library/Internet\ Plug-Ins -name "$bundle_id*" -o -name "$app_name*" -print0 2>/dev/null)
# QuickLook Plugins
[[ -d ~/Library/QuickLook/"$app_name".qlgenerator ]] && files_to_clean+=("$HOME/Library/QuickLook/$app_name.qlgenerator")
# Preference Panes
[[ -d ~/Library/PreferencePanes/"$app_name".prefPane ]] && files_to_clean+=("$HOME/Library/PreferencePanes/$app_name.prefPane")
# Screen Savers
[[ -d ~/Library/Screen\ Savers/"$app_name".saver ]] && files_to_clean+=("$HOME/Library/Screen Savers/$app_name.saver")
# Frameworks
[[ -d ~/Library/Frameworks/"$app_name".framework ]] && files_to_clean+=("$HOME/Library/Frameworks/$app_name.framework")
# CoreData
while IFS= read -r -d '' coredata; do
files_to_clean+=("$coredata")
done < <(find ~/Library/CoreData -name "*$bundle_id*" -o -name "*$app_name*" -print0 2>/dev/null)
# Only print if array has elements to avoid unbound variable error # Only print if array has elements to avoid unbound variable error
if [[ ${#files_to_clean[@]} -gt 0 ]]; then if [[ ${#files_to_clean[@]} -gt 0 ]]; then
printf '%s\n' "${files_to_clean[@]}" printf '%s\n' "${files_to_clean[@]}"
fi fi
} }
# Find system-level app files (requires sudo)
find_app_system_files() {
local bundle_id="$1"
local app_name="$2"
local -a system_files=()
# System Application Support
[[ -d /Library/Application\ Support/"$app_name" ]] && system_files+=("/Library/Application Support/$app_name")
[[ -d /Library/Application\ Support/"$bundle_id" ]] && system_files+=("/Library/Application Support/$bundle_id")
# System Launch Agents
[[ -f /Library/LaunchAgents/"$bundle_id".plist ]] && system_files+=("/Library/LaunchAgents/$bundle_id.plist")
# System Launch Daemons
[[ -f /Library/LaunchDaemons/"$bundle_id".plist ]] && system_files+=("/Library/LaunchDaemons/$bundle_id.plist")
# Privileged Helper Tools
while IFS= read -r -d '' helper; do
system_files+=("$helper")
done < <(find /Library/PrivilegedHelperTools -name "$bundle_id*" -print0 2>/dev/null)
# System Preferences
[[ -f /Library/Preferences/"$bundle_id".plist ]] && system_files+=("/Library/Preferences/$bundle_id.plist")
# Installation Receipts
while IFS= read -r -d '' receipt; do
system_files+=("$receipt")
done < <(find /private/var/db/receipts -name "*$bundle_id*" -print0 2>/dev/null)
# Only print if array has elements
if [[ ${#system_files[@]} -gt 0 ]]; then
printf '%s\n' "${system_files[@]}"
fi
}
# Calculate total size of files (consolidated from duplicates) # Calculate total size of files (consolidated from duplicates)
calculate_total_size() { calculate_total_size() {
local files="$1" local files="$1"

2
mole
View File

@@ -20,7 +20,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh" source "$SCRIPT_DIR/lib/common.sh"
# Version info # Version info
VERSION="1.3.3" VERSION="1.4.0"
MOLE_TAGLINE="can dig deep to clean your Mac." MOLE_TAGLINE="can dig deep to clean your Mac."
# Check for updates (non-blocking, cached) # Check for updates (non-blocking, cached)