A similar discussion was recently posted in the question Which tool is most flexible for searching my whole system, locate
or mdfind
?. I was unable to get various incantations of mdfind
to do searches that locate
had no problems with. I suggest using the standard BSD locate
facility. Here's what I did to solve your particular case using locate
, which was not much:
$ locate Firefox | grep -i '^/Users/whmcclos.*cache' | head
/Users/whmcclos/Library/Caches/Firefox
/Users/whmcclos/Library/Caches/Firefox/Profiles
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default/.DS_Store
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default/Cache
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default/Cache/0
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default/Cache/0/06
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default/Cache/0/06/ACA5Bd01
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default/Cache/0/06/B30CEd01
/Users/whmcclos/Library/Caches/Firefox/Profiles/cr8059k0.default/Cache/0/09
[...]
but these incantations of mdfind
yielded nothing really useful to you:
$ mdfind kMDItemFSName="Firefox"
/Users/whmcclos/Library/Application Support/Firefox
/Users/whmcclos/Desktop/Programs/Internet/Firefox
/Volumes/Time Machine/Time Machine Safe/Users/whmcclos/Documents/Programs/Internet/Firefox
and
$ mdfind -name "Firefox" | grep '^/Users/whmcclos.*cache'
I'm certain it is a permission issue with allowing the meta-data creation facility permission to search and display the proper user login areas, which have restrictive group
and user
ownership permission; I'm not sure if the user:_spotlight
ACL is granting permissions to other tools that only have limited, if any, group
and user
permissions - I'm still investigating this convoluted issue. I checked, and I haven't restricted Spotlight with any Privacy settings to the areas you are searching.
As you are probably aware, you can check and change the ACL with /bin/ls -le
and chmod -a
or chmod +a
, as in this little sequence that I keep around in my notes file because I use this so infrequently and the syntax isn't intuitive:
# viewing ACL and changing the same:
$ ls -le
total 16
-rw-r--r--+ 1 whmcclos staff 1918 Dec 18 09:00 README
0: user:_spotlight inherited allow read,execute,readattr,readextattr,readsecurity
-rw-r--r--+ 1 whmcclos staff 192 Nov 15 12:30 try.pl
0: user:_spotlight inherited allow read,execute,readattr,readextattr,readsecurity
$ chmod -a "user:_spotlight allow read,execute,readattr,readextattr,readsecurity" README
$ ls -le
total 16
-rw-r--r-- 1 whmcclos staff 1918 Dec 18 09:00 README
-rw-r--r--+ 1 whmcclos staff 192 Nov 15 12:30 try.pl
0: user:_spotlight inherited allow read,execute,readattr,readextattr,readsecurity
$ chmod +ai "user:_spotlight allow read,execute,readattr,readextattr,readsecurity" README
$ ls -le
total 16
-rw-r--r--+ 1 whmcclos staff 1918 Dec 18 09:00 README
0: user:_spotlight inherited allow read,execute,readattr,readextattr,readsecurity
-rw-r--r--+ 1 whmcclos staff 192 Nov 15 12:30 try.pl
0: user:_spotlight inherited allow read,execute,readattr,readextattr,readsecurity
Towards that end, and towards understanding how to fine tune locate
and how it searches the FS to populate its internal /var/db/locate.database
, we've come up with a fairly portable group permission membership utility if you'd care to explore if changing various file user
and group
permissions will add visibility to Spotlights search results. I haven't had a chance to try that, yet. Quite frankly, I've been very happy since I re-enabled locate
in OSX.