Suddenly discovered a large number of writes on the disk recently,Open the task manager,Found a process called "lsd" continues to occupy 20% – 40% CPU,Very strange。
After some inquiries,Learned that this process is a system process on macOS and iOS,Full name is "Launch Service Daemon",Responsible for all App file type association and startup。But its database is sometimes damaged,This causes it to frequently read and verify certain data。
Once its database is damaged,You will encounter lsd occupation 100% CPU,Or a lot of memory,Even huge disk writes...
Anyway,We can make it re-register all necessary files,Rebuild the database: find /System/Library/Frameworks -type f -name "lsregister" -exec {} -kill -seed -r \;
or,Use this command: /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user This theoretically performs the same task as the previous sentence,Just the former search lsregister And the latter directly gives the path。
References:
https://discussions.apple.com/thread/8365107?answerId=33313731022#33313731022
https://discussions.apple.com/thread/250050422?answerId=250085966022#250085966022
Original article written by LogStudio:R0uter's Blog » /usr/libexec/lsd occupied 100% CPU solution
Reproduced Please keep the source and description link:https://www.logcg.com/archives/3382.html
Yes! The first command, run as root worked. lsd is no longer using 100% cpu and my Mac is not horribly slow.
sudo find /System/Library/Frameworks -type f -name “lsregister” -exec {} -kill -seed -r \;
How long will the reconstruction process of this database take? I used this command because the preview of some files is abnormal,The preview is now normal,But always occupy the cpu in the background,It's been a day,46G write capacity,
These two commands are not the same,I tried the above command,Does not occupy cpu now。It seems that the additional parameters will cause problems,It may also be a problem with the macOS version.,I think it seems to be 2009 when the following order was first given on the Internet,,,
Is it different? I gonna go see。
This command is very old,I think I have used both... I forgot,Just get it done。
Another problem,Now use the command with fewer parameters to solve the problem of lsd occupying the cpu,But the preview of qlmarkdown is still not working;Commands with many parameters can solve the preview problem (this issue https://github.com/toland/qlmarkdown/issues/39),但是lsd一直占cpu,我醉了😭
Kind of plug-in,I used a large one before,I couldn’t use it later... I don’t need it now 😂
Solved the case,Qlmarkdown conflicts with the finder plugin of Nut Cloud,,,Everything is normal after uninstalling Nut Cloud。(Stupid Nutstore,,,)