I have the following entry in root's crontab:

0 */4 * * * cd /private/var/root && ./locate.updatedb

I have an alias for locate in ~/.zshrc:

alias locate='locate -d /var/db/locate.database'   

When I do a "locate Table_Synthesis_GREY_" , in all the full paths of files found, the first slash of the path indicating the file system root is missing. Here is a sample of the ouput:


How can I have paths output as absolute paths, i.e. starting at /Users? The desired output is


as opposed to


UPDATE 1: I have copied /usr/libexec/locate.updatedb into my home root, that is in /var/root/ . I did that since I could not modify the /usr/libexec/locate.updatedb file, even being root or with sudo.

So in this other file /var/root/locate.updatedb, I could do the modification :

if [ "$(id -u)" = "99" ]; then

instead of initially :

if [ "$(id -u)" = "0" ]; then

What do you think about this trick ? and mostly why I have not the first slash displayed when results into my /Users/henry/.

0 */4 * * * cd /private/var/root ; /bin/sh locate.updatedb

but issue remains.

By the way, if results are located into /Applications or other main directories but not systematically, the first slash is well displayed.

Anyone has a clue ?

  • 1
    Is that a different locate.updatedb from the system one? How did you configure it? Jan 10 at 22:30
  • 1
    I half suspect that you may get better answers on unix.stackexchange.com. When asking there, I suggest that you focus on how it seems to return relative instead of absolute paths
    – jstarek
    Jan 12 at 8:43
  • 1
    Please don't put part of the question into the bounty message, it's hard to read there and a lot of people will just ignore it. Edit the question instead to contain all relevant details.
    – nohillside
    Jan 12 at 8:45
  • 1
    Also, you seem to ask several questions at once. What is the role of the test if the id of the current user is 99?
    – nohillside
    Jan 12 at 8:49
  • @nohillside I have change id of the current to not be dependent of nobody user default user that doesn't index all the directories by default. I think there is no link between this change and my issue here.
    – youpilat13
    Jan 16 at 16:04

You must log in to answer this question.

Browse other questions tagged .