The MacBook Pro on my desk is a 2020 model with an Intel i5-1038NG7 (4 cores, 8 threads) and 16 GB of memory, running macOS 15.7.3. Recently I noticed that the fans kept spinning loudly even though I wasn't doing anything heavy. A quick look at top showed a load average between 10 and 17, and the top of the list was occupied by system processes: lsd, syspolicyd, trustd and duetexpertd. None of them was an app I had opened myself. lsd alone stayed at around 50% for a long time.
The machine had been up for 74 days, and I didn't really want to reboot it. I also still use Setapp and had no plan to uninstall it. So everything below was done without rebooting and without uninstalling anything. After the CPU usage came down, I went back through the data I had exported, to figure out three things: how the problem came about, how to recognize it at a glance next time, and whether it can be prevented.
Background
LaunchServices and lsd
LaunchServices is the macOS service that keeps a registry of applications. Whenever the system needs to know where an app is installed, what its bundle ID is, or which file types it can open, it looks it up in the database maintained by LaunchServices. Components such as the Dock and Finder, as well as background services like Siri Suggestions, all query it. lsd is the daemon that owns this database; adding and removing entries goes through it.
Judging from the data this time, once an app has been registered, its entry stays in the database even after the directory containing it is deleted or ejected. The various system services only find out that the file is gone when they query it, and the error code they get back is -43, i.e. fnfErr (file not found).
While lsd was registering bundles, its log was full of SecTrustEvaluateIfNecessary and SecKeyVerifySignature calls, i.e. code signature verification. syspolicyd's log showed the same calls, and trustd is the daemon responsible for certificate trust evaluation. As we will see, once lsd calmed down, syspolicyd and trustd disappeared from the CPU ranking along with it.
lsregister
The command-line tool for working with this database is lsregister. It isn't on the PATH and lives deep inside the system:
1 | LSREG=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister |
The following options are used below:
-dump: dump the entire contents of the database-u: unregister the given path-f: force re-registration, even if the modification date hasn't changed-gc: garbage-collect old data and compact the database-kill: reset the database before doing anything else
Investigation and Fix
Two kinds of anomalies
top can tell us who is busy, but not what they are busy with. To find out what lsd was doing, I had to dig into the unified log. Two things kept showing up there.
The first was lsd's own registration records (timestamps and thread IDs removed):
1 | lsd[412] [com.apple.appinstallation:TransactionLog] (null)/Unknown Persona:5:4:1:0:_LSServerRegisterItemInfo begin |
lsd registered Setapp (com.setapp.DesktopClient) on behalf of PID 415, recording it as unit 0x2dee88; 7 milliseconds later, PID 75950 asked to unregister that very unit. PID 415 was the Dock, and 75950 was SetappAgent. Within two minutes there were 693 such registrations, close to 6 per second on average. Meanwhile, SetappAgent's own log kept printing Failed to get unit … from store, with an ever-increasing number.
The second was error -43 reported by other processes, for example siriknowledged:
1 | siriknowledged[645] [com.apple.launchservices:default] _LSBundleCopyOrCheckNode: cached node not found, _LSBundleCreateNode for bundleID 60316 returned -43 |
Counted by process, within 10 seconds siriknowledged reported 1488 of them, duetexpertd 454, swcd 262, and bird, the iCloud Drive daemon, 163. An earlier 30-second count gave 6098 lines involving 265 distinct bundle IDs.
The commands for counting both anomalies are in the "Recognizing the Problem" section later on.
Dead entries
To find out which bundles the -43 errors pointed to, I first dumped the database:
1 | "$LSREG" -dump > /tmp/lsdump.txt |
The dump was 23 MB, with more than 260,000 lines. I then checked whether each path: still existed; the exact commands are in the "Recognizing the Problem" section. Note that every path: line ends with the entry's ID, like /Applications/Setapp.app (0x2f9f30). That suffix has to be stripped first, or every path will be reported as missing.
Of 1455 unique paths, 337 no longer existed. Below, I call such entries, which point to paths that no longer exist, dead entries.
I first tried the gentlest option, -gc. The number of -43 errors per 10 seconds dropped from 2924 to 1749, so it only cleared part of them. I then ran lsregister -u on each path in the list of dead entries; 312 of the 337 returned success. Counted again 15 seconds later, there was only 1 -43 error per 10 seconds.
The registration loop
The -43 errors were gone, but lsd was still registering at a rate of 73 times per 10 seconds. Its CPU usage was still around 50%, and syspolicyd was still at 40%. The two biggest sources were still the Dock and SetappAgent. I had quit Setapp once at the beginning of the investigation, but SetappAgent came back under a new PID: its LaunchAgent is configured with KeepAlive, so quitting Setapp doesn't stop it.
After forcing a re-registration of /Applications/Setapp.app with -f, the loop didn't stop right away. A few minutes later I restarted the Dock:
1 | # launchd brings the Dock back immediately |
Ten seconds later, lsd's registration count was 0, and so was SetappAgent's Failed to get unit. lsd, syspolicyd and trustd disappeared from the CPU ranking, and the load average dropped from a peak of 20.37 to 4.27. When I checked again a few hours later, lsd hadn't registered anything in 5 minutes, and there was only one -43 error. The problem had not come back.
Causes
Looking back, this was really two problems stacked on top of each other: the -43 errors caused by dead entries, and the registration loop caused by Setapp. The former dragged in processes like siriknowledged and duetexpertd; the latter kept lsd, syspolicyd and trustd spinning. They need to be explained separately.
Where the dead entries came from
First, when were the dead entries registered? lsregister -dump records a reg date field for each entry. Here are the 337 dead entries counted by month of registration:
1 | 2025-07: 43 2025-08: 28 2025-09: 9 2025-10: 13 |
From July 2025 to November 2026, almost every month added somewhere between a dozen and a few dozen. In other words, the dead entries piled up gradually over more than a year; they weren't created all at once by a single operation.
Grouped by path, they turn out to come from a few very ordinary, everyday operations:
- Chrome auto-updates: 93. Chrome keeps each version under
Google Chrome Framework.framework/Versions/<version>/and deletes the old version directory after updating. The dead entries covered 41 different version numbers, from 137 all the way to 153, while the directory now only contains 155 and 156 - Sparkle's temporary directories: 66. Sparkle is the framework many macOS apps use for automatic updates. It downloads and unpacks the new version into a randomly named subdirectory under
~/Library/Caches/<app>/org.sparkle-project.Sparkle/, and deletes it after installing. DingTalk accounted for 26 and Setapp for 35 - Installer disk images: 57. When you double-click a DMG to install an app, the apps on the mounted volume get registered too, and their entries remain after the volume is ejected. Every version of PixCake since 8.0.1 left a few behind; the earliest was registered on 2025-08-17
- Homebrew upgrades: 46, almost all old versions of
/usr/local/Cellar/python@3.x - Manual backups: 16, e.g.
pixcake.app.bak-10.0.5-156
These categories have one thing in common: the directory containing the app was temporary to begin with and was deleted after use, but LaunchServices doesn't clean up after it. The flags on the entries support this. The database held 1460 entries in total, which split into 339 dead entries and 1121 live ones depending on whether the path exists (339 is two more than the 337 above because two of the paths each had two entries). The quarantined flag was set on 30% of dead entries but only 1% of live ones; for launch-disabled it was 49% versus 10%. The former means the file was downloaded from the internet and hasn't been approved yet; the latter means launching from that location isn't allowed. Apps on installer images and in update packages usually carry both.
When a single dead entry is queried, a single -43 is returned and that's the end of it. But some services enumerate the entire database; judging by its name, siriknowledged wants to know which apps are installed on the system. With many dead entries, every enumeration reports hundreds of -43 errors; and if enumeration is triggered frequently, the CPU usage never comes down.
Why enumeration was triggered so often
As for what kept triggering the enumeration, I only have one indirect clue. In SetappAgent's log, interleaved with Failed to get unit, this line kept appearing:
1 | SetappAgent[75950] [com.apple.launchservices:db] NotifyToken::RegisterDispatch(user.uid.501.com.apple.LaunchServices.database) fired for session key <private> |
Judging by the name, this is the notification posted when the LaunchServices database changes, and it fired several times per second. Every time the database changes, processes subscribed to this notification may query it again, and a registration loop running 6 times per second keeps the database changing constantly. So the two problems may have amplified each other: the registration loop keeps the database posting notifications, the notifications keep other services enumerating, and each enumeration runs into hundreds of dead entries. I didn't verify this directly, though; there is no evidence that siriknowledged enumerated because of this notification.
Where the registration loop came from
The starting point of the registration loop is fairly clear. /Applications/Setapp.app and Setapp's four plists under ~/Library/LaunchAgents/ all had a modification time of 21:12 the previous evening, when Setapp had updated itself.
The key evidence lies in two dumps of the database. One was /tmp/lsdump.txt, exported at 11:24 in the morning while investigating the dead entries; the other was /tmp/lsdump2.txt, which I exported at 11:37 after re-registering with -f. In the first one, /Applications/Setapp.app was not in the database at all:
1 | grep -c 'path:[[:space:]]*/Applications/Setapp.app (' /tmp/lsdump.txt # exported at 11:24 |
The first gives 0 and the second gives 1. In other words, after Setapp updated itself, the registration of its main app was lost. The database did still contain SetappAgent and a few other helpers under ~/Library/Application Support/Setapp/LaunchAgents/. SetappAgent's own log says the bundle's modification date "changed from Fri Sep 25 10:31:27 2026 to Fri Nov 6 21:12:41 2026", followed by Failed to get unit.
From this, one can infer the following process: the Dock looks for com.setapp.DesktopClient, can't find it in the database, and asks lsd to register it; right after that, SetappAgent unregisters the unit; the Dock can't find it again and asks lsd to register it again. The log doesn't say why SetappAgent unregisters it. Throughout this time lsd never stopped verifying signatures, and syspolicyd and trustd stayed busy too. I don't know when the loop started; the log only confirms that Setapp rewrote its own files at 21:12 the previous evening.
This inference explains why -f alone wasn't enough: -f put the main app back into the database, but the Dock may still have held on to stale state, so it took a Dock restart to stop the loop. However, a few minutes passed between -f and restarting the Dock, and I only did this once, so I can't separate how much each step contributed. As for why Setapp's update lost the registration of its main app, I couldn't find out.
Recognizing the Problem
To sum up what I learned, the next time something similar happens, it can be diagnosed in the following order.
First, look at the combination in the CPU ranking. If lsd is high, syspolicyd and trustd are near the top as well, and none of the apps you opened yourself is particularly busy, suspect that LaunchServices is registering something over and over. If the top of the list is taken by background services that are normally quiet, such as siriknowledged, duetexpertd and swcd, suspect that they are running into dead entries while enumerating.
Then measure two indicators: lsd's registration rate and the rate of -43 errors:
1 | # Indicator 1: lsd registrations in the last minute |
For reference, in its normal state this machine had no lsd registrations at all in 5 minutes, and only one -43 error. While the problem was going on, the former was over 300 per minute and the latter over 10,000 per minute. The two states are so far apart that you don't need a precise threshold to tell them apart.
If the registration rate is high, find out who is initiating the registrations. lsd's log records on whose behalf each registration was made:
1 | log show --last 1m --predicate 'process == "lsd" AND eventMessage CONTAINS "on behalf of pid"' --style compact \ |
Once you have the PID, use ps -p <PID> to see the process name. If the same app is being registered over and over, check whether its main app is in the database:
1 | "$LSREG" -dump | grep -c 'path:[[:space:]]*/Applications/Setapp.app (' |
If there are many -43 errors, count the dead entries:
1 | # Dump the database, extract all paths, and strip the trailing (0x…) |
This time, 337 out of 1455 were dead, close to a quarter. I don't know what this ratio should be on a healthy machine; I have no other machine to compare with.
Prevention
The dead entries come from everyday operations such as Chrome updates, Sparkle updates, installer images and Homebrew. These operations can't be avoided; what can be done is to have fewer dead entries and to notice them earlier. There are three things to do.
First, after installing an app, unregister the apps on the installer image while you're at it. The moment the image is ejected, the entries for the apps on it become dead entries, so ejecting alone isn't enough. In principle, unregistering while the image is still mounted and then ejecting it should work, but I haven't actually tried this order yet:
1 | # Before ejecting, unregister the apps on the volume from the database (not tested) |
For images that have already been ejected, you can clean them all up using the method from the previous section; this worked in practice:
1 | # Unregister every entry under /Volumes that no longer exists |
An app often has more than one entry. For example, on Cursor's installer image, besides Cursor.app, four helpers were registered separately. That makes the latter method the more convenient one.
Second, run the counts from the previous section periodically. Going by registration dates, on this machine somewhere between a dozen and a few dozen entries per month eventually became dead entries, so cleaning up every few months should be enough. Use -u to unregister them one by one. -kill resets the entire database and rescans it, which affects every app; this problem only involved a few hundred entries that had already been listed, so there was no need for it.
Third, when an auto-updating app misbehaves, first make sure its main app is still in the database. That is exactly where Setapp went wrong this time. If it isn't there, re-register it with lsregister -f; if the loop continues after that, restart the Dock.
Note that the only criterion for deciding whether an entry is dead is whether its path exists. Apps on an external drive are also reported as missing when the drive isn't connected. Before unregistering in bulk, go through dead_paths.txt and pick out such paths.