Skip to content

Instantly share code, notes, and snippets.

@dive
Created December 16, 2021 10:35
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dive/7e646933bd97bb4feeae234a3c51ff8a to your computer and use it in GitHub Desktop.
Save dive/7e646933bd97bb4feeae234a3c51ff8a to your computer and use it in GitHub Desktop.
Fix the iOS 15 Simulator high CPU usage due to the Spotlight/Suggestions Engine
#!/bin/env sh
disable_suggestions() {
if [ -d "$1" ]; then
pushd "$1" || return
find . -name com.apple.suggestions.plist \
-exec echo {} \; \
-exec plutil -replace SuggestionsAppLibraryEnabled -bool NO {} \;
popd || return
fi
}
disable_suggestions "${HOME}/Library/Developer/Xcode/UserData/Previews/Simulator Devices/"
disable_suggestions "${HOME}/Library/Developer/CoreSimulator/Devices/"
@dive
Copy link
Author

dive commented Dec 16, 2021

@ricardopereira
Copy link

Thank you!

The script was failing for me with:
./fix_ios_simulator_spotlight_cpu.sh: bad interpreter: /bin/env: no such file or directory

I found out that the more common path to env is /usr/bin/env. I changed to #!/usr/bin/env sh and it's working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment