mirror of
https://github.com/tw93/Mole.git
synced 2026-02-11 16:28:59 +00:00
Simplify the content deleted by the system
This commit is contained in:
@@ -106,30 +106,6 @@ clean_deep_system() {
|
|||||||
safe_sudo_find_delete "/private/var/db/diagnostics/Special" "*.tracev3" "30" "f" && diag_logs_cleaned=1 || true
|
safe_sudo_find_delete "/private/var/db/diagnostics/Special" "*.tracev3" "30" "f" && diag_logs_cleaned=1 || true
|
||||||
stop_section_spinner
|
stop_section_spinner
|
||||||
[[ $diag_logs_cleaned -eq 1 ]] && log_success "System diagnostic trace logs"
|
[[ $diag_logs_cleaned -eq 1 ]] && log_success "System diagnostic trace logs"
|
||||||
# Clean core symbolication cache (can be 3-5GB, mostly for crash report debugging)
|
|
||||||
# Will regenerate when needed for crash analysis
|
|
||||||
# Use faster du with timeout instead of get_path_size_kb to avoid hanging
|
|
||||||
debug_log "Checking core symbolication cache..."
|
|
||||||
if [[ -d "/System/Library/Caches/com.apple.coresymbolicationd/data" ]]; then
|
|
||||||
debug_log "Symbolication cache directory found, checking size..."
|
|
||||||
# Quick size check with timeout (max 5 seconds)
|
|
||||||
local symbolication_size_mb=""
|
|
||||||
symbolication_size_mb=$(run_with_timeout 5 du -sm "/System/Library/Caches/com.apple.coresymbolicationd/data" 2> /dev/null | awk '{print $1}')
|
|
||||||
# Validate that we got a valid size (non-empty and numeric)
|
|
||||||
if [[ -n "$symbolication_size_mb" && "$symbolication_size_mb" =~ ^[0-9]+$ ]]; then
|
|
||||||
debug_log "Symbolication cache size: ${symbolication_size_mb}MB"
|
|
||||||
# Only clean if larger than 1GB (1024MB)
|
|
||||||
if [[ $symbolication_size_mb -gt 1024 ]]; then
|
|
||||||
debug_log "Cleaning symbolication cache (size > 1GB)..."
|
|
||||||
if safe_sudo_remove "/System/Library/Caches/com.apple.coresymbolicationd/data"; then
|
|
||||||
log_success "Core symbolication cache (${symbolication_size_mb}MB)"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
debug_log "Failed to get symbolication cache size, skipping cleanup"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
debug_log "Core symbolication cache section completed"
|
|
||||||
}
|
}
|
||||||
# Clean incomplete Time Machine backups
|
# Clean incomplete Time Machine backups
|
||||||
clean_time_machine_failed_backups() {
|
clean_time_machine_failed_backups() {
|
||||||
|
|||||||
@@ -96,9 +96,6 @@ clean_macos_system_caches() {
|
|||||||
# Clean saved application states with protection for System Settings
|
# Clean saved application states with protection for System Settings
|
||||||
# Note: safe_clean already calls should_protect_path for each file
|
# Note: safe_clean already calls should_protect_path for each file
|
||||||
safe_clean ~/Library/Saved\ Application\ State/* "Saved application states" || true
|
safe_clean ~/Library/Saved\ Application\ State/* "Saved application states" || true
|
||||||
# REMOVED: Spotlight cache cleanup can cause system UI issues
|
|
||||||
# Spotlight indexes should be managed by macOS automatically
|
|
||||||
# safe_clean ~/Library/Caches/com.apple.spotlight "Spotlight cache"
|
|
||||||
safe_clean ~/Library/Caches/com.apple.photoanalysisd "Photo analysis cache" || true
|
safe_clean ~/Library/Caches/com.apple.photoanalysisd "Photo analysis cache" || true
|
||||||
safe_clean ~/Library/Caches/com.apple.akd "Apple ID cache" || true
|
safe_clean ~/Library/Caches/com.apple.akd "Apple ID cache" || true
|
||||||
safe_clean ~/Library/Caches/com.apple.WebKit.Networking/* "WebKit network cache" || true
|
safe_clean ~/Library/Caches/com.apple.WebKit.Networking/* "WebKit network cache" || true
|
||||||
@@ -107,7 +104,6 @@ clean_macos_system_caches() {
|
|||||||
safe_clean ~/Library/Caches/com.apple.QuickLook.thumbnailcache "QuickLook thumbnails" || true
|
safe_clean ~/Library/Caches/com.apple.QuickLook.thumbnailcache "QuickLook thumbnails" || true
|
||||||
safe_clean ~/Library/Caches/Quick\ Look/* "QuickLook cache" || true
|
safe_clean ~/Library/Caches/Quick\ Look/* "QuickLook cache" || true
|
||||||
safe_clean ~/Library/Caches/com.apple.iconservices* "Icon services cache" || true
|
safe_clean ~/Library/Caches/com.apple.iconservices* "Icon services cache" || true
|
||||||
safe_clean ~/Library/Caches/CloudKit/* "CloudKit cache" || true
|
|
||||||
# Clean incomplete downloads
|
# Clean incomplete downloads
|
||||||
safe_clean ~/Downloads/*.download "Safari incomplete downloads" || true
|
safe_clean ~/Downloads/*.download "Safari incomplete downloads" || true
|
||||||
safe_clean ~/Downloads/*.crdownload "Chrome incomplete downloads" || true
|
safe_clean ~/Downloads/*.crdownload "Chrome incomplete downloads" || true
|
||||||
|
|||||||
@@ -86,6 +86,12 @@ declare -a DEFAULT_WHITELIST_PATTERNS=(
|
|||||||
"$HOME/Library/Caches/com.jetbrains.toolbox*"
|
"$HOME/Library/Caches/com.jetbrains.toolbox*"
|
||||||
"$HOME/Library/Caches/com.apple.finder"
|
"$HOME/Library/Caches/com.apple.finder"
|
||||||
"$HOME/Library/Mobile Documents*"
|
"$HOME/Library/Mobile Documents*"
|
||||||
|
# System-critical caches that affect macOS functionality and stability
|
||||||
|
# CRITICAL: Removing these will cause system search and UI issues
|
||||||
|
"$HOME/Library/Caches/com.apple.FontRegistry*"
|
||||||
|
"$HOME/Library/Caches/com.apple.spotlight*"
|
||||||
|
"$HOME/Library/Caches/com.apple.Spotlight*"
|
||||||
|
"$HOME/Library/Caches/CloudKit*"
|
||||||
"$FINDER_METADATA_SENTINEL"
|
"$FINDER_METADATA_SENTINEL"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user