Skip to content

Instantly share code, notes, and snippets.

Last active January 31, 2024 01:24
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save christovic/c9aef6c1aa5f6aa258ea8f12e4c10724 to your computer and use it in GitHub Desktop.
launchctl stop && launchctl start
vers=$( sw_vers | grep BuildVersion | awk '{print substr($2,0,2)}' )
if [[ "${vers}" > "18" ]]; then
cd "${sdir}"
# First let's check if the directory we're adding already exists
let index="`plutil -extract Exclusions xml1 -o - VolumeConfiguration.plist | grep string | grep -wn "${search_string}" | cut -d ':' -f 1` - 1"
if [ $index -lt 0 ]; then
echo Not in array, let\'s add it in.
plutil -insert Exclusions.0 -string ${search_string} "${sdir}/VolumeConfiguration.plist"
echo Already in array, not doing anything.
# 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