MacOS – cannot locate app, locate not working

bashcommand linemacosspotlight

I have an app (gv) where I can run it from the terminal, but when I click on it, I get errors. This makes me think there are multiple instances of it or something. I tried which and got nothing… that seems odd. so then I tried locate, which gave me this warning:

$ which gv
$ locate gv

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

I ran sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
but when I run locate, I still get this message. yes, I can run find, but it is taking forever. How can I get locate working? I am on OSX 10.6.8

Best Answer

The launchd job can be run manually so you can see the progress.

Since locate runs find for you, that will also take forever, but perhaps you can inspect the progress or error condition the understand if the locate database is not getting built if you are patient:

time sudo /usr/libexec/locate.updatedb

While that runs, you could try spotlight as it likely has indexed that binary and can report back orders of magnitude faster than the options above:

mdfind "kMDItemFSName == 'gv'"