<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="">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><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On 17 Nov, 2021, at 13:31, Peter Hancock <<a href="mailto:hancock@fastmail.fm" class="">hancock@fastmail.fm</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 17/11/2021 15:46, Chris Jones wrote:<br class=""><blockquote type="cite" class="">Some users might find it useful, and the exact volume to exclude<br class="">depends on the details of the users installation, which would be<br class="">difficult to automate. So I think its fine to just leave it to be<br class="">done by hand by those that wish to.<br class="">On 17/11/2021 3:09 pm, AndrĂ©-John Mas wrote:<br class=""><blockquote type="cite" class="">Just wondering whether it would make sense for MacPorts to auto<br class="">exclude that folder? Does spotlight even provide an API or command<br class="">that would allow MacPorts to do that?>><br class=""></blockquote></blockquote><br class="">AndrĂ©-John Mas mentions folders (directories?), while Chris Jones mentions volumes<br class="">(mounted filesystems?).<br class=""><br class="">On Catalina, for me the command "sudo mdutil -i off /opt/local/var/macports "<br class="">evokes:<br class="">[<br class="">Password:<br class="">/System/Volumes/Data/opt/local/var/macports:<br class="">Error: invalid operation.<br class=""><span class="Apple-tab-span" style="white-space:pre">   </span>Error: unknown indexing state.<br class="">]<br class=""><br class="">Trying to drag that directory into the appropriate System Preferences "privacy" pane,<br class="">accomplishes nothing. It doesn't appear on the list.<br class=""><br class="">My man page for mdutil seems to speak only about volumes. A bit of googling suggests<br class="">that though there *may* have been a time when you could exclude various directories<br class="">from spotlight indexing, by one trick or another, those days are gone.<br class=""><br class="">Am I wrong?<br class=""><br class="">I hope so. I'm getting pretty dyspeptic about how much of my computer seems to be<br class="">taken over by Spotlight and it's various underlings/minions.<br class=""><br class="">(Eg, It/they seem(s) to spend a large chunk of resources on creating tens/hundreds of thousands<br class="">of empty directories deep under /private/var/folders, to no apparent purpose.)<br class=""><br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>