I've been trying to update the databases used by locate on my Macbook (10.6.3 Snow Leopard) but even following the commands shown in this thread hasn't gotten me anywhere. I just get an error from it - if I try to use it via sudo, I get some racket about permission denied for such-n-such directory. I tried running it as root (sudo su, then the command) and that didn't work either. Quit back to my regular terminal prompt, and now I just get

macbook:~ monte$ sudo /usr/libexec/locate.updatedb
find: .: Permission denied
macbook:~ monte$

I'm thoroughly confused, and half afraid that I may have hosed something in the process. Any help or suggestions would be greatly appreciated!

Monte

link|improve this question

feedback

2 Answers

You might want to try to repair file permissions (in the Disk Utility application). Sounds like it might be an issue with that.

Also, not directly related to locate, but I've found that on the mac that mdfind actually does what I want quite a bit better than locate does. It's the command line interface to spotlight, and it lets you find just by file name if you want to mimic locate:

mdfind -name <filename>

Just using "mdfind " will find both file names and look inside files (sort of grep/find put together).

No need to manually update the database for it as OSX maintains the spotlight information for you.

link|improve this answer
Apparently the disk did(does) have some issues... I needed to boot from a backup disk and repair some problems (some file links), after which I booted off the main internal drive and repaired the permissions - and there was a whole slew of corrections. The bizarre part is if I re-run the 'repair permissions' option after clearing the display... I get most of the same errors again (says that 'SUID file "System/Library/..." has been modified and will not be repaired. And I still get the same message when I tried to run locate.updatedb via sudo. – memilanuk Jul 9 '10 at 5:20
feedback
launchctl load -wF /System/Library/LaunchDaemons/com.apple.locate.plist

If it doesn't help, try:

launchctl stop com.apple.locate

launchctl start com.apple.locate
link|improve this answer
Take a look inside the plist -- the LaunchDaemon does nothing but executing /usr/libexec/locate.updatedb itself. The user has a permissions issue running it as root. Why'd it work when running via launch? – Daniel Beck Jan 25 '11 at 14:28
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.