Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

launchservices-health

БесплатноБез исполняемых скриптовНе проверен

Diagnose macOS LaunchServices DB bloat and launchservicesd CPU spikes. Use when launchservicesd is pegged at high CPU or WindowServer XPC stalls are suspected.

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

LaunchServices Health (macOS)

When to Use This Skill

Use this skill when... Use something else when...
launchservicesd is at sustained high CPU General process forensics — use ps/top directly
GUI feels sluggish after weeks of uptime The machine actually hung — see macos-incident-postmortem
Quantifying LS DB bloat (size, bundle count, claim count) Checking app launch failures — use system_profiler SPApplicationsDataType
Deciding whether lsregister rebuild is warranted First-time install setup — use configure-plugin

Platform Guard

This skill is macOS-only. The lsregister binary, launchservicesd daemon, and the LaunchServices database are Darwin-specific. Refuse to act if uname -s is not Darwin.

test "$(uname -s)" = "Darwin" || { echo "macos-plugin: not Darwin, refusing"; exit 1; }

Core Expertise

LaunchServices is the macOS subsystem that maps documents and URL schemes to applications. State is held by launchservicesd and persisted to a binary database. Two failure modes matter:

  1. DB bloat — over months of uptime and app churn (Homebrew updates, Xcode reinstalls, Wine/CrossOver bottle creation, Electron app upgrades), the DB accumulates stale bundle records and duplicate claims. The bigger the DB, the slower lsregister -dump runs and the more memory launchservicesd holds.
  2. Daemon wedge — launchservicesd can spin at high CPU when a misbehaving process repeatedly registers/unregisters bundles. WindowServer makes synchronous XPC calls into launchservicesd for icon and document-handler lookups; a wedged daemon manifests as a frozen GUI.

The diagnostic answer is always: measure first, rebuild only if warranted. Rebuild (lsregister -kill -r ...) takes minutes, makes every app's "open with" disappear briefly, and rebuilds the DB from scratch — only do it when the metrics justify it.

Where the bits live

Path Purpose
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister The lsregister CLI — not on $PATH, must be invoked by absolute path
~/Library/Application Support/com.apple.PersistentURLTranslator/ Per-user persisted state
/var/folders/*/0/com.apple.LaunchServices* LS cache directories (varies by macOS version)

Quick Snapshot

The reference script ls-stats produces a one-page health snapshot. Install at ~/.local/bin/ls-stats (mode 0755):

#!/usr/bin/env bash
# ls-stats: macOS LaunchServices DB + launchservicesd health snapshot
set -euo pipefail

[ "$(uname -s)" = "Darwin" ] || { echo "not Darwin" >&2; exit 1; }

LSREG=/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister
PID=$(pgrep -x launchservicesd) || { echo "launchservicesd not running" >&2; exit 1; }

DUMP=$(mktemp); trap 'rm -f "$DUMP"' EXIT
"$LSREG" -dump >"$DUMP" 2>/dev/null

echo "=== launchservicesd ==="
ps -o pid,rss,etime,command -p "$PID" | sed 's/^/  /'

echo
echo "=== LaunchServices DB ==="
wc -c <"$DUMP" | awk '{printf "  size:    %d bytes (%.1f MB)\n", $1, $1/1048576}'
printf "  bundles: %d\n" "$(grep -c '^bundle id:' "$DUMP")"
printf "  claims:  %d\n" "$(grep -c '^claim '    "$DUMP")"
printf "  records: %d\n" "$(grep -c '^----'      "$DUMP")"

echo
printf "=== Diagnostic reports ===\n  launchservicesd CPU events: %d\n" \
  "$(ls /Library/Logs/DiagnosticReports/ 2>/dev/null | grep -c launchservicesd)"

echo
echo "=== Uptime ==="
uptime | awk '{print "  " $0}'

The script prints four blocks: daemon process state (RSS, etime), DB size and counts, recent CPU diagnostic-report count, and current uptime. All numbers are absolute — interpret them against the baseline thresholds below.

Interpreting the Snapshot

launchservicesd RSS

RSS (KB) Meaning
< 50 000 (~50 MB) Healthy
50 000 – 150 000 Normal for active use
150 000 – 400 000 Bloated; consider rebuild
> 400 000 (~400 MB) Pathological; rebuild warranted

Daemon etime (elapsed time since launch)

launchservicesd is launched once per boot and lives until reboot. etime close to uptime is normal. etime significantly less than uptime means the daemon was relaunched mid-session — usually after a crash; check Diagnostic Reports.

DB size

Size Meaning
< 5 MB Normal
5 – 20 MB Healthy heavy-app workstation
20 – 50 MB Bloated; rebuild improves things
> 50 MB Pathological

Bundle / claim / record counts

There is no absolute threshold — these matter relative to the expected number of installed apps. Useful sanity check:

ls /Applications /Applications/Utilities ~/Applications 2>/dev/null | wc -l

If bundle id: count is 5x or more above the visible-.app count, the DB has stale records.

Diagnostic-report CPU event

Полный SKILL.md на GitHub

Установить launchservices-health в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(uname *)
Bash(ps *)
Bash(pgrep *)
Bash(uptime *)
Bash(awk *)
Bash(grep *)
Bash(wc *)
Bash(ls *)
Bash(stat *)
Bash(mktemp *)
Bash(rm *)
Read
Write
Edit
Grep
Glob

FAQ

Что делает скилл launchservices-health?

Diagnose macOS LaunchServices DB bloat and launchservicesd CPU spikes. Use when launchservicesd is pegged at high CPU or WindowServer XPC stalls are suspected.

Как установить скилл launchservices-health?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл launchservices-health запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить launchservices-health с