I Fixed My Slow Mac and Found an Apple Bug
Diagnosing a slow MacBook Pro with an LLM: display scaling, Rosetta binaries, one plausible wrong theory, and a Mach port leak in a macOS daemon.
The standard warning about language models is that they fabricate facts, so the standard defense is to verify every citation. During a recent debugging session on my Mac, I verified every fact the model gave me: every system log line in its diagnosis was real and present on disk.
The diagnosis was still wrong. The model attributed a sustained 45% CPU load to an event that fired twice in 10 minutes, and neither of us checked the event rate against the CPU load for an hour. Fact-checking individual log lines does not catch a plausible narrative assembled out of true details. Switching from log interpretation to direct process profiling immediately exposed the real culprit: a dispatch-queue leak inside a macOS system daemon.
My M1 Max MacBook Pro had been stuttering heavily, especially during Microsoft Teams screen shares. I pasted three Activity Monitor screenshots into an LLM session and granted it step-by-step terminal access. Here is what we found.


1. Non-integer 4K display scaling
The first bottleneck took under a minute to isolate.
My external BenQ 4K monitor (3840×2160) was configured to the macOS scaled setting "Looks like 2560×1440". At non-integer scaling factors, macOS does not render at 2560×1440; it renders an offscreen canvas at 2× that target (5120×2880) and downsamples the frame to 3840×2160 for the physical panel. That forces the GPU and compositor to push 77% more pixels than the monitor actually displays on every frame.
WindowServer—the macOS compositor process—was consuming 124% CPU at idle. Switching the display to native resolution dropped WindowServer CPU usage to 53% immediately.
During the same pass, we spotted Granola running 10 helper processes while holding the macOS microphone audio subsystem open continuously for 18 hours, and quit it.
2. Intel git and node running under Rosetta 2
Next, we inspected the binary architectures of the tools running inside my shell.

Both git and node were resolving to x86_64 Intel binaries on an Apple Silicon (arm64) machine, forcing macOS to run them through Rosetta 2 instruction translation on every invocation. Because my oh-my-zsh prompt executes git status after every terminal command—and my daily workflow runs node continuously inside Claude Code and local dev servers—my two most heavily executed binaries were paying translation overhead all day.
The root cause was two parallel Homebrew installations: an older Intel installation under /usr/local (110 packages and 1,365 symlinks) sitting ahead of the native Apple Silicon installation under /opt/homebrew in my PATH. A year earlier, I had installed the x86 toolchain temporarily for a single legacy project; when that project ended, /usr/local/bin remained first in .zshrc.
The same path shadowing affected Node.js: nvm had nine installed versions, and although an arm64 build of Node 22 was already installed on disk, a hardcoded path in .zshrc pinned the shell to an older x86_64 Node 22 build.
Removing the legacy /usr/local Homebrew tree and pointing .zshrc to native arm64 builds of git and node noticeably sped up every terminal command and build script.
3. Disk capacity above the 90% swap threshold
The internal SSD was 92% full (only 36 GB free). macOS virtual memory and APFS performance degrade noticeably once free space drops below ~15%.
Application caches accounted for 24 GB, and the macOS WhatsApp desktop client held 36 GB—33 GB of which consisted of cached video and image attachments from four group chats. Uninstalling the desktop WhatsApp client and clearing caches freed 33 GB immediately, bringing disk usage down to 85%.
4. The plausible wrong theory
Two Apple system daemons—ecosystemanalyticsd and ecosystemd—were still pinning roughly 45% to 50% of a CPU core each. Inspecting log show output surfaced repeated Rosetta Mach-O check failures and code-signature validation warnings. The LLM connected those log entries into a clean causal explanation: a tight retry loop triggered by unsigned or mismatched binaries.

Every log entry cited in that explanation was real, and the conclusion was completely wrong.
After I deleted the Intel git binary, the CPU load did not budge. When we finally checked the timestamps on the log entries, we realized those warnings fired twice every 10 minutes. Two events in ten minutes cannot consume 45% of a CPU core continuously. Both the model and I had accepted a narrative that fit the text of the logs without checking the frequency math.
I asked the LLM to stop reading system logs and profile the running process directly with sample.
The first two profiling attempts returned empty output with exit code 0. The LLM interpreted the silent output as a System Integrity Protection (SIP) permissions block and went back to reading logs.
Instead of accepting that explanation, I checked which sample. Homebrew had installed a Python package CLI named sample at /opt/homebrew/bin/sample, which shadowed the native macOS profiler at /usr/bin/sample. Running /usr/bin/sample with its absolute path returned a complete call-stack profile in 10 seconds.
5. The actual bug: 551 leaked dispatch queues in ecosystemanalyticsd

The profiler output showed that ecosystemanalyticsd was holding 551 live com.apple.security.XPCTimeStampingService.trust serial dispatch queues in memory. Each time the daemon performed a code-signature timestamp check, it allocated a new XPC dispatch queue and failed to release it upon completion. After 30 hours of uptime, the daemon had accumulated 551 leaked queues, 254,889 Mach ports, and 1.4 GB of resident memory.
That leak explained why CPU usage scaled with uptime rather than event frequency: every routine background check had to traverse hundreds of leaked queue structures and Mach port registrations.

Shortly after we captured the profile, the macOS kernel terminated ecosystemanalyticsd for exceeding its Mach port limit and respawned a fresh instance. Over the next 55 minutes under the exact same workload, the fresh process consumed 0.06 seconds of total CPU time and 7.7 MB of RAM.
Before and after metrics
| Metric | Before | After |
|---|---|---|
| Load average (10-core M1 Max) | 12.73 | 1.91 |
WindowServer CPU | 124% | 53% |
ecosystemanalyticsd CPU | 45.8% | 0.0% |
ecosystemanalyticsd memory | 1.4 GB (254,889 ports) | 7.7 MB |
ecosystemd CPU | 50.6% | 0.0% |
| Free disk space | 36 GB (92% full) | 69 GB (85% full) |
git binary | Intel 2.46.2 (Rosetta) | Universal 2.50.1 (native arm64) |
node binary | x86_64 v22.6.0 (Rosetta) | arm64 v22.22.3 (native) |
| 4K monitor render buffer | 5120×2880 downsampled | 3840×2160 native |
I packaged the /usr/bin/sample call graph and Mach port counts into a bug report and submitted it to Apple via Feedback Assistant.

Takeaways on debugging with an LLM
- Grant terminal permissions in tiers: Start with read-only inspection commands, approve configuration changes one at a time, and review file deletions separately.
- Demand measurements over log narratives: Language models excel at stitching disparate log warnings into a coherent story. Always check whether the event frequency in the logs can mathematically account for the observed CPU or memory load, and reach for a profiler (
sample,spindump,instruments) early. - Verify silent tool failures: When a CLI command returns zero output, verify
which <binary>and the exit code before assuming the OS blocked access.
Summary
- External 4K display was set to
"Looks like 2560×1440", forcingWindowServerto render a5120×2880buffer (77% extra pixels) on every frame. - Legacy
/usr/localHomebrew paths shadowed/opt/homebrew, causinggitandnodeto run asx86_64Intel binaries under Rosetta 2 translation. - Internal SSD was 92% full, with 36 GB consumed by cached WhatsApp desktop media and 24 GB in user caches.
- Apple’s
ecosystemanalyticsddaemon leakedcom.apple.security.XPCTimeStampingService.trustdispatch queues on every signature check, accumulating 551 queues, 254,889 Mach ports, and 1.4 GB RAM over 30 hours.
- Shared Activity Monitor CPU and Memory screenshots with an LLM session and ran read-only diagnostics first.
- Switched the 4K monitor to native scaling, removed the Intel Homebrew installation, and cleared 33 GB of disk caches.
- Rejected the model’s initial log-based retry-loop theory after noticing the log warnings fired only twice per 10 minutes.
- Resolved a PATH conflict where
/opt/homebrew/bin/sampleshadowed/usr/bin/sample, profiledecosystemanalyticsddirectly, and filed the Mach port leak with Apple.