How to fix QuickLookUIService memory/CPU issues in High Sierra
I'm unable to post this as a reply to any of the posts I found about this issue because they are all locked. If you're having issues with high memory (or CPU) usage on High Sierra, this is the result of a bug with the QuickLookUIService which appears to have been introduced in that version and which unfortunately has not yet been fixed. The only workaround right now is to repeatedly force quit the quicklookuiservice in activity monitor. I did find a more pleasant workaround that I hope helps.
- Create a new file in your favourite text editor (if you use Apple's Text Edit make sure the file is in plain text format)
- Paste the xml at the end of these steps into the file
- Rename the file to the same as what's within the <string> tags with a .plist extension (in my example, 'com.zerowidth.launched.killquicklook.plist')
- Copy the file to your library in the 'LaunchAgents' folder (in Finder you can use Go > Go to folder > /Users/[yourusername]/Library/LaunchAgents. You may need to type an administrator password to authorize this action
- After your next login/restart, you should find the memory issues caused by this to be back to normal. If you ever want to remove the service, just delete the plist file
Some explanation of what this does. A launch agent is a service that helps manage applications in Mac OS. In this case, we've written our own small launch agent program that kills the quicklook service repeatedly at an interval (the 'killall -9 -v QuickLookUIService' part). The name of the service is within the <string> tags (you can call it what you like) and the interval is within the <integer> tags (in my case, 5600 seconds). Feel free to change the interval to whatever works best for you (if you set it higher, it will interfere less with your normal use of preview, but also allow the service to use more memory). As a final note, bear in mind that if you are previewing a document when the service restarts, the preview will fail (you can just preview again immediately).
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zerowidth.launched.killquicklook</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>killall -9 -v QuickLookUIService</string>
</array>
<key>StartInterval</key>
<integer>5600</integer>
</dict>
</plist>
MacBook Pro (13-inch Mid 2012)