Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# We can find the index of the item in the array by extracting the key, finding the lines with
# 'string' in them, and then finding the search string.
cd /System/Volumes/Data/.Spotlight-V100
let index="`plutil -extract Exclusions xml1 -o - VolumeConfiguration.plist | grep string | grep -wn "${search_string}" | cut -d ':' -f 1` - 1"
echo The index of $search_string is $index
if [ $index -lt 0 ]; then
echo Not in array, not doing anything.
echo Found $search_string in array, removing it
plutil -remove Exclusions.${index} /System/Volumes/Data/.Spotlight-V100/VolumeConfiguration.plist
# Now we restart mds to apply the changes
launchctl stop && launchctl start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment