Skip to content

Instantly share code, notes, and snippets.

@meoow
Created August 7, 2014 15:03
Show Gist options
  • Save meoow/fe083a46f62963e436e5 to your computer and use it in GitHub Desktop.
Save meoow/fe083a46f62963e436e5 to your computer and use it in GitHub Desktop.
automatically prevents spotlight indexing on usb drives
<?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>EnableGlobbing</key>
<false/>
<key>Label</key>
<string>external_drives_no_index</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>mount | sed -n 's|^/dev/disk[[:digit:]]\{1,\}\(s[[:digit:]]\{1,\}\)\{0,1\} on \(/Volumes/.\{1,\}\) ([^(]\{1,\})$|\2|p' | while read x;do if [[ ! -e "$x/.metadata_never_index" ]];then touch "$x/.metadata_never_index"; fi; if [[ -d "$x/.Spotlight-V100" ]];then rm -rf "$x/.Spotlight-V100";fi; done</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>StartOnMount</key>
<true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment