Mole icon indicating copy to clipboard operation
Mole copied to clipboard

[BUG] `mo clean` didn't complete successfully

Open Lemonawa opened this issue 4 months ago β€’ 10 comments

Describe the bug

Image

After running this command, the arrow below is red, which probably means it did not run successfully.

Steps to reproduce

  1. Run command: mo clean
  2. Pet the cat
  3. See error

Expected behavior

It should be completed successfully

Debug logs

Please run the command with --debug flag and paste the output here:

mo clean --debug
Debug output
Clean Your Mac

● Use --dry-run to preview, --whitelist to manage protected paths
βœ“ Admin access granted

βš™ Apple Silicon | Free space: 95Gi
βœ“ Whitelist: 11 core patterns active

➀ Deep system
[DEBUG] Finding (sudo) in /Library/Caches: *.cache (age: 7d, type: f)
[DEBUG] Finding (sudo) in /Library/Caches: *.tmp (age: 7d, type: f)
[DEBUG] Finding (sudo) in /Library/Caches: *.log (age: 7d, type: f)
  βœ“ System caches
[DEBUG] Finding (sudo) in /private/tmp: * (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/tmp: * (age: 7d, type: f)
  βœ“ System temp files
[DEBUG] Finding (sudo) in /Library/Logs/DiagnosticReports: * (age: 7d, type: f)
  βœ“ System crash reports
[DEBUG] Finding (sudo) in /private/var/log: *.log (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/log: *.gz (age: 7d, type: f)
  βœ“ System logs
[DEBUG] Finding (sudo) in /private/var/db/diagnostics/Special: * (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/db/diagnostics/Persist: * (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/db/DiagnosticPipeline: * (age: 7d, type: f)
  βœ“ System diagnostic logs
[DEBUG] Finding (sudo) in /private/var/db/powerlog: * (age: 7d, type: f)
  βœ“ Power logs
  βœ“ Nothing to clean

➀ User essentials
[DEBUG] Cleaning: User app cache (19 items)
[DEBUG] Cleaning: User app logs (5 items)
[DEBUG] Cleaning: Trash (0 items)
  | Scanning 1 external volume(s)...[TIMEOUT] Shell fallback (1s): mount
  βœ“ Nothing to clean

➀ Finder metadata
  β—‹ Finder metadata Β· whitelist protected

➀ macOS system caches
[DEBUG] Cleaning: Saved application states (0 items)
[DEBUG] Cleaning: Photo analysis cache (0 items)
[DEBUG] Cleaning: Apple ID cache (0 items)
[DEBUG] Cleaning: WebKit network cache (0 items)
[DEBUG] Cleaning: Diagnostic reports (0 items)
[DEBUG] Cleaning: QuickLook thumbnails (0 items)
[DEBUG] Cleaning: QuickLook cache (0 items)
[DEBUG] Cleaning: Icon services cache (0 items)
[DEBUG] Cleaning: CloudKit cache (0 items)
[DEBUG] Cleaning: Safari incomplete downloads (0 items)
[DEBUG] Cleaning: Chrome incomplete downloads (0 items)
[DEBUG] Cleaning: Partial incomplete downloads (0 items)
[DEBUG] Cleaning: Autosave information (0 items)
[DEBUG] Cleaning: Identity caches (0 items)
[DEBUG] Cleaning: Siri suggestions cache (0 items)
[DEBUG] Cleaning: Calendar cache (0 items)
[DEBUG] Cleaning: Address Book photo cache (0 items)
[DEBUG] Cleaning: Recent items preferences (0 items)

~                                                                                                                                                          12s
❯

Environment

Please run mo update to ensure you are on the latest version, then paste the output of mo --version below:

Mole version 1.15.1
macOS: 26.2
Architecture: arm64
Kernel: 25.2.0
SIP: Enabled
Disk Free: 95Gi
Install: Manual
Shell: /bin/zsh

Additional context

Installed from Homebrew

Lemonawa avatar Dec 28 '25 10:12 Lemonawa

Hi @Lemonawa,

This timeout issue has been fixed in version 1.15.2.

Root cause: The scan_external_volumes function was using run_with_timeout 1 mount to verify volume mount status. On systems with many mount points or network filesystems, the mount command could exceed the 1-second timeout, causing the failure you observed.

Fix: Replaced the slow mount command with a lightweight directory accessibility check ([[ -d "$volume" && -r "$volume" ]]). This is both faster and more reliable, as the volume was already validated earlier in the scan.

Please update to the latest version: mo update

tw93 avatar Dec 28 '25 12:12 tw93

I upgraded to the latest version, but this command still failed to execute successfully.

Debug output
Clean Your Mac

● Use --dry-run to preview, --whitelist to manage protected paths
βœ“ Admin access granted

βš™ Apple Silicon | Free space: 95Gi
βœ“ Whitelist: 11 core patterns active

➀ Deep system
[DEBUG] Finding (sudo) in /Library/Caches: *.cache (age: 7d, type: f)
[DEBUG] Finding (sudo) in /Library/Caches: *.tmp (age: 7d, type: f)
[DEBUG] Finding (sudo) in /Library/Caches: *.log (age: 7d, type: f)
  βœ“ System caches
[DEBUG] Finding (sudo) in /private/tmp: * (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/tmp: * (age: 7d, type: f)
  βœ“ System temp files
[DEBUG] Finding (sudo) in /Library/Logs/DiagnosticReports: * (age: 7d, type: f)
  βœ“ System crash reports
[DEBUG] Finding (sudo) in /private/var/log: *.log (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/log: *.gz (age: 7d, type: f)
  βœ“ System logs
[DEBUG] Finding (sudo) in /private/var/db/diagnostics/Special: * (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/db/diagnostics/Persist: * (age: 7d, type: f)
[DEBUG] Finding (sudo) in /private/var/db/DiagnosticPipeline: * (age: 7d, type: f)
  βœ“ System diagnostic logs
[DEBUG] Finding (sudo) in /private/var/db/powerlog: * (age: 7d, type: f)
  βœ“ Power logs
[DEBUG] Finding (sudo) in /private/var/db/reportmemoryexception/MemoryLimitViolations: * (age: 30d, type: f)
  βœ“ Memory exception reports
  | Cleaning diagnostic trace logs...[DEBUG] Finding (sudo) in /private/var/db/diagnostics/Persist: *.tracev3 (age: 30d, type: f)
[DEBUG] Finding (sudo) in /private/var/db/diagnostics/Special: *.tracev3 (age: 30d, type: f)
  βœ“ System diagnostic trace logs
[DEBUG] Checking core symbolication cache...
[DEBUG] Core symbolication cache section completed
[DEBUG] Checking Aliyun security components...
[DEBUG] Aliyun security components check completed, cleaned: 0

~                                                                                                                                                           8s
❯ 

Lemonawa avatar Dec 28 '25 12:12 Lemonawa

@Lemonawa Thanks for the detailed bug report! I've identified and fixed the issue.

Root Cause: The script uses set -euo pipefail, so any command failure causes immediate exit. The spinner cleanup functions had several echo/printf commands without || true error handling, which could fail silently in certain terminal environments and cause the script to exit unexpectedly.

Fix: Added || true to terminal output commands in spinner functions to prevent script termination on I/O errors.

Resolution: Fixed in version 1.15.4. Please run mo update to get the latest version and let me know if this resolves the issue. Thanks!

tw93 avatar Dec 28 '25 13:12 tw93

I’ve also encountered the same issue even after updating to version 1.15.4.

Additionally, it hasn’t been released through GitHub, right? I can’t update it using mo update, but I can use HomeBrew.

Lemonawa avatar Dec 28 '25 14:12 Lemonawa

@Lemonawa There may be a delay in updates, try mo update again. or brew update

Image

tw93 avatar Dec 28 '25 14:12 tw93

Yes, I confirm that it failed at the same position even after updating to version 1.15.4.

Lemonawa avatar Dec 28 '25 14:12 Lemonawa

@Lemonawa Keep trying 1.15.5, I have removed this problematic piece of code.

tw93 avatar Dec 28 '25 16:12 tw93

It gets further for me but still fails.

Clean Your Mac

● Use --dry-run to preview, --whitelist to manage protected paths
βœ“ Admin access granted

βš™ Apple Silicon | Free space: 207Gi
βœ“ Whitelist: 12 core patterns active

➀ Deep system
  βœ“ System caches
  βœ“ System temp files
  βœ“ System crash reports
  βœ“ System logs
  βœ“ System diagnostic logs
  βœ“ Power logs
  βœ“ Memory exception reports
  βœ“ System diagnostic trace logs
  βœ“ Nothing to clean

➀ User essentials
  βœ“ User app cache 251 items (16.66GB)
  βœ“ User app logs 40 items (48.9MB)

➀ Finder metadata
  β—‹ Finder metadata Β· whitelist protected

➀ macOS system caches
  βœ“ Saved application states 15 items (180KB)
  βœ“ Partial incomplete downloads 2 items (41.2MB)

~ took 1m1s
❯ echo $?
1
➀ macOS system caches
[DEBUG] Cleaning: Saved application states (0 items)
[DEBUG] Cleaning: Photo analysis cache (0 items)
[DEBUG] Cleaning: Apple ID cache (0 items)
[DEBUG] Cleaning: WebKit network cache (0 items)
[DEBUG] Cleaning: Diagnostic reports (0 items)
[DEBUG] Cleaning: QuickLook thumbnails (0 items)
[DEBUG] Cleaning: QuickLook cache (0 items)
[DEBUG] Cleaning: Icon services cache (0 items)
[DEBUG] Cleaning: CloudKit cache (0 items)
[DEBUG] Cleaning: Safari incomplete downloads (0 items)
[DEBUG] Cleaning: Chrome incomplete downloads (0 items)
[DEBUG] Cleaning: Partial incomplete downloads (0 items)
[DEBUG] Cleaning: Autosave information (0 items)
[DEBUG] Cleaning: Identity caches (0 items)
[DEBUG] Cleaning: Siri suggestions cache (0 items)
[DEBUG] Cleaning: Calendar cache (0 items)
[DEBUG] Cleaning: Address Book photo cache (0 items)
[DEBUG] Cleaning: Recent items preferences (0 items)

samchouse avatar Dec 28 '25 17:12 samchouse

It works for me when I use iTerm2. Which terminal are you using?

Shakura404 avatar Dec 28 '25 18:12 Shakura404

Ghostty

samchouse avatar Dec 28 '25 18:12 samchouse

For me, granting full disk access to my terminal (Warp, in this case) solved the issue.

Vader-7 avatar Dec 29 '25 02:12 Vader-7

@samchouse @Vader-7 @Lemonawa @Shakura404 Thank you very much for your patience in debugging me. At present, I continue to repair a thorough version. Please update to the latest version 1.15.8 to see if it's okay. If it's not good, please tell me - debug log

tw93 avatar Dec 29 '25 07:12 tw93