Skip to content

Instantly share code, notes, and snippets.

@pkutzner
Created February 13, 2014 21:17
Show Gist options
  • Save pkutzner/8984036 to your computer and use it in GitHub Desktop.
Save pkutzner/8984036 to your computer and use it in GitHub Desktop.
Disable indexing of ALL attached external drives. Replace PATH_TO_NOINDEX_SCRIPT with its name's-sake in the .plist file.
<?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.index.no_index</string>
<key>Disabled</key>
<false/>
<key>Program</key>
<string>PATH_TO_NOINDEX_SCRIPT</string>
<key>StartOnMount</key>
<true/>
<key>RunAtLoad</key>
<false/>
<key>KeepAlive</key>
<false/>
<key>EnableTransactions</key>
<true/>
</dict>
</plist>
#!/bin/bash
for filename in /Volumes/*; do
if [ ! -L "$filename" ]; then
file="${filename}/.metadata_never_index"
if [ ! -e "$file" ]; then
touch "$file"
fi
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment