<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Long ago, I was told that Spotlight would not index a folder and its subfolders if the file <font color="#000000" class="">.metadata_never_index was present.  I can’t vouch for this (mostly because I generally disable Spotlight), but it is perhaps something that someone can try and see if works, for example:</font><div class=""><br class=""></div><div class="">$ sudo touch /opt/local/.metadata_never_index</div><div class=""><br class=""></div><div class="">Also, I think there is some programmatic / CLI way to add folders to the excluded list because if you have Roxio Toast installed, it adds some folders to the Privacy list that shows up in System Preferences.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">-ranga<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 17, 2021, at 11:49, Richard L. Hamilton <<a href="mailto:rlhamil@smart.net" class="">rlhamil@smart.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Nov 17, 2021, at 14:16, André-John Mas <<a href="mailto:andrejohn.mas@gmail.com" class="">andrejohn.mas@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">When looking at "System Preferences -> Spotlight -> Privacy", you can configure exclusions by folder.<div class=""><br class=""></div><div class="">I had a look at the mdutil command and no reference to folders or paths is mentioned, when looking from macOS 12.0.1:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">Usage: mdutil -pEsa -i (on|off) -d volume ...</div><div class="">       mdutil -t {volume-path | deviceid} fileid</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>Utility to manage Spotlight indexes.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>-i (on|off)    Turn indexing on or off.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>-d             Disable Spotlight activity for volume (re-enable using -i on).</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>-E             Erase and rebuild index.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>-s             Print indexing status.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>-a             Apply command to all stores on all volumes.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>-t             Resolve files from file id with an optional volume path or device id.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>-p             Publish metadata.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">  </span>-V vol         Apply command to all stores on the specified volume.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>-v             Display verbose information.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>-r plugins     Ask the server to reimport files for UTIs claimed by the listed plugin.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>-L volume-path List the directory contents of the Spotlight index on the specified volume.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>-P volume-path Dump the VolumeConfig.plist for the specified volume.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>-X volume-path Remove the Spotlight index directory on the specified volume.  Does not disable indexing.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>               Spotlight will reevaluate volume when it is unmounted and remounted, the</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>               machine is rebooted, or an explicit index command such as 'mdutil -i' or 'mdutil -E' is</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>               run for the volume.</div><div class="">NOTE: Run as owner for network homes, otherwise run as root.</div></blockquote><div class=""><br class=""></div><div class="">I am starting to wonder if there is another command we should be using, in place of mdutil?<br class=""></div></div></div></blockquote><br class=""></div><div class="">As I implied before, I don't think there's an md* command or even a public API to add or edit the folders to exclude. Rather, I suspect that the Spotlight preference pane has some private interface to do the job.</div><div class=""><br class=""></div><div class="">I could probably figure out how to do that using the "defaults" command and tell you, but I won't, because the risk of corrupting that file and possibly breaking Spotlight for that volume is one I won't encourage. Figure it out yourself if you're willing to risk shooting yourself in the foot. Looking a bit at the executable for the preference pane, I don't quite see what it does (it doesn't seem to directly edit the .Spotlight-V100/VolumeConfiguration.plist file for the volume (I think that tree exists per-volume, not just one for the whole system), but I haven't looked closely to determine more), but it seems that it may at least take some precautions you might not - there seems to be some check for paths that might break (presumably Apple-supplied - they couldn't know what other apps do) apps that depend on Spotlight access to certain directories.</div><br class=""><div class="">So I agree that MacPorts shouldn't exclude its noisy (with respect to Spotlight updates) directory automatically. If it's a performance problem, it's easily enough done through the preference pane.</div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>