Created
November 5, 2021 15:24
-
-
Save mayoff/1c12f3344e6a84b83a996efb931eec74 to your computer and use it in GitHub Desktop.
A launchd agent (put it in ~/Library/LaunchAgents) to stop simulator Spotlight processes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.dqd.stop-simulator-spotlight</string> | |
<key>ProcessType</key> | |
<string>Background</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/bin/sh</string> | |
<string>-c</string> | |
<string>/bin/ps -wwxo 'pid state command' | /usr/bin/grep '/CoreSimulator/.*/Spotlight$' | /usr/bin/awk '$2 ~/^[^T]/ { print $1 }' | /usr/bin/xargs /bin/kill -STOP</string> | |
</array> | |
<key>StartInterval</key> | |
<integer>10</integer> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Xcode 13's simulator starts a Spotlight process that continuously spews errors to the system log. This is still happening as of at least Xcode 13.2 beta 1.
This launchd agent looks for simulator Spotlight processes every 10 seconds, and sends them SIGSTOP if they're not already stopped.
Put the file in
~/Library/LaunchAgents
, then either reboot or run this: