I also haven't found an intended command line way or program API to add a 
directory to exclude from Spotlight. (they are buried in a plist file in the 
Spotlight data directory for the particular mount point, and one could use 
command line tools to add it there, but I would NOT recommend risking it)

But in System Preferences ->Spotlight->Privacy tab, the usual command-shift-G 
type the path works just fine to set a directory (not needing to be a volume 
mount point) to exclude. That's probably needed because /opt/local/var/macports 
has the Finder invisible flag set.

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

-- 
eMail:                          mailto:[email protected]




Reply via email to