1

I got a directory /private/var/directory that I'd like to index using Spotlight. It looks like everything under /private/var/ is excluded from indexing. I tried to import it using:

mdimport /private/var/directory

But it didn't work. I also thought it might be excluded by some kind of sandboxed environment, but I couldn't figure out if that is the case.

As a last resort I could move the directory somewhere else but I'd rather not do that as it would be a lot of work in this particular case.

How can I force Spotlight to index this directory?

1

As you know it is a Hidden Folder and therefore it is not indexed by Spotlight.

You could change the Flag for the folder from hidden to no hidden using the terminal command:

sudo chflags nohidden /private/var/directory

To test, using Finder navigate to the /private/var/directory with Go To.

Now right click and use Get Info. does it still show it as Hidden?

get info

To make Spotlight re-index that folder:

From the Apple () menu, choose System Preferences.
Click Spotlight.
Click the Privacy tab.
Drag a folder or an entire volume (your hard drive) to the list.
If prompted for confirmation, click OK.
Remove the item or volume you just added to the list by clicking it and then clicking the minus ("-") button.
Close Spotlight preferences.

Spotlight will re-index the contents of the folder or volume.

  • I did the above but the files aren't found by spotlight. I also reindexed by adding the harddisk to privacy and then remove it again. – barney765 Feb 11 '15 at 16:53
  • Navigate to the /private/var/directory in Finder using the Go To then right click and Get Info, what does it say, is it locked? red circle on the Folder Icon ? – Ruskes Feb 11 '15 at 17:18
  • It's not locked and no red circle. – barney765 Feb 12 '15 at 18:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .