Agree with all this. Maybe just something to add to the docs or FAQ? André-John
Sent from my phone. Envoyé depuis mon téléphone. > On 17 Nov 2021, at 14:49, Richard L. Hamilton <[email protected]> wrote: > > > >> On Nov 17, 2021, at 14:16, André-John Mas <[email protected]> wrote: >> >> When looking at "System Preferences -> Spotlight -> Privacy", you can >> configure exclusions by folder. >> >> I had a look at the mdutil command and no reference to folders or paths is >> mentioned, when looking from macOS 12.0.1: >> >> Usage: mdutil -pEsa -i (on|off) -d volume ... >> mdutil -t {volume-path | deviceid} fileid >> Utility to manage Spotlight indexes. >> -i (on|off) Turn indexing on or off. >> -d Disable Spotlight activity for volume (re-enable using >> -i on). >> -E Erase and rebuild index. >> -s Print indexing status. >> -a Apply command to all stores on all volumes. >> -t Resolve files from file id with an optional volume path >> or device id. >> -p Publish metadata. >> -V vol Apply command to all stores on the specified volume. >> -v Display verbose information. >> -r plugins Ask the server to reimport files for UTIs claimed by the >> listed plugin. >> -L volume-path List the directory contents of the Spotlight index on >> the specified volume. >> -P volume-path Dump the VolumeConfig.plist for the specified volume. >> -X volume-path Remove the Spotlight index directory on the specified >> volume. Does not disable indexing. >> Spotlight will reevaluate volume when it is unmounted >> and remounted, the >> machine is rebooted, or an explicit index command such >> as 'mdutil -i' or 'mdutil -E' is >> run for the volume. >> NOTE: Run as owner for network homes, otherwise run as root. >> >> I am starting to wonder if there is another command we should be using, in >> place of mdutil? > > 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. > > 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. > > 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. >
