This discussion is locked
Rob Frei

Q: Trouble with "locate"

I was just using "locate" on my MBP yesterday, and it was working great. Today, not so much

It doesn't want to look for anything ...

For example, if I type in:

+locate fontconfig+

it doesn't do anything. I simply get a new command prompt.

I know locate utilizes a DB that is built up over a period of time, but my DB should already be in existence. Like I said, I was just using it yesterday and it was working great.

Any ideas? Thx!

Eight-Core Mac Pro & MacBook Pro, Mac OS X (10.6.3), 13GB 667 MHz DDR2 RAM, 2.5 TB RAID 0, Drobo

Posted on Nov 1, 2010 2:30 PM

Close

Q: Trouble with "locate"

  • All replies
  • Helpful answers

  • by Lurch66,

    Lurch66 Lurch66 Nov 1, 2010 4:33 PM in response to Rob Frei
    Level 1 (25 points)
    Nov 1, 2010 4:33 PM in response to Rob Frei
    Try rebuilding the locate and find databases by going into Terminal and typing the following (minus the #):

    # sudo periodic daily weekly monthly


    Of course you could also see if Spotlight can find what you're looking for, also from Terminal:

    # mdfind fontconfig
  • by g_wolfman,

    g_wolfman g_wolfman Nov 1, 2010 4:59 PM in response to Rob Frei
    Level 4 (1,141 points)
    Nov 1, 2010 4:59 PM in response to Rob Frei
    I'm fairly sure that the periodic tasks no longer update the locate database.

    You'll probably have to run /usr/libexec/locate.updatedb manually, or (better) play with the /System/Library/LaunchDaemons/com.apple.locate.plist property list to ensure it's getting run properly.
  • by BobHarris,

    BobHarris BobHarris Nov 1, 2010 5:52 PM in response to Rob Frei
    Level 6 (19,546 points)
    Mac OS X
    Nov 1, 2010 5:52 PM in response to Rob Frei
    When I first tried 'locate' it told me to issue the following command:

    sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
  • by Rob Frei,

    Rob Frei Rob Frei Nov 1, 2010 6:35 PM in response to Rob Frei
    Level 1 (105 points)
    Nov 1, 2010 6:35 PM in response to Rob Frei
    Unfortunately,

    sudo periodic daily weekly monthly

    didn't seem to do anything. Running:

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

    informed me that locate.plist is already loaded. Running:

    /usr/libexec/locate.updatedb

    seemed to perform an update. I noticed a lot of CPU and HD activity (and it took a while to execute). However, locate still isn't working.

    Could you possibly elaborate on this Bob:

    or (better) play with the /System/Library/LaunchDaemons/com.apple.locate.plist property list to ensure it's getting run properly

    Not sure what you mean.

    Thanks all for your help.
  • by David Wood,

    David Wood David Wood Nov 1, 2010 7:26 PM in response to Rob Frei
    Level 2 (181 points)
    Mac App Store
    Nov 1, 2010 7:26 PM in response to Rob Frei
    As g_wolfman mentioned, periodic system tasks under Snow Leopard no longer update the database; see Marcel Bresink's notes accompanying his TinkerTool System Release 2. This excellent utility provides a GUI for many system maintenance tools, including updating locate.updatedb.
  • by g_wolfman,

    g_wolfman g_wolfman Nov 1, 2010 8:08 PM in response to Rob Frei
    Level 4 (1,141 points)
    Nov 1, 2010 8:08 PM in response to Rob Frei

    Could you possibly elaborate on this Bob:

    or (better) play with the /System/Library/LaunchDaemons/com.apple.locate.plist property list to ensure it's getting run properly

    Not sure what you mean.

    Actually, that was me. I meant you might need to edit the .plist to make sure the key/value that ensures the locate database is periodically updated is set. And then reload the .plist, of course.

    Unfortunately, I can't tell you off the top of my head what the particular key/value pair is...I actually use TinkerTool System myself, so I haven't any need to go I to that particular .plist and manually change that property.

    I would simlarly imagine that you could use a "defaults read" command to dump the contents of that particular domain, find the current value of the property and then craft a "defaults write" command to set the property. If necessary, that is.
  • by Rob Frei,

    Rob Frei Rob Frei Nov 2, 2010 7:43 AM in response to Rob Frei
    Level 1 (105 points)
    Nov 2, 2010 7:43 AM in response to Rob Frei
    Thanks David & Wolfman.

    I just dl'd TinkerTools & TinkerTool System (was not aware of these). The GUI's look helpful (in many ways). I'm running the locate DB update now. Thanks for the tip!

    I believe the DB is updating fine. See my terminal output pasted in below. However, whenever I issue a locate command, nothing happens ...

    $ locate ical
    $

    is what I get ... (instantly) ... every time ...

    Do you think an environment variable isn't set properly?

    Terminal Output showing locate.database latest update follows ... the time stamp here represents the update I just ran using TinkerTool System:


    Last login: Tue Nov 2 09:29:28 on ttys001
    _ _ __ _
    /\ /\_| | | _ /__\ _ | |__
    / /_/ / _ \ | |/ _ \ / \/// _ \| '_ \
    / __ / __/ | | (_) | / _ \ (_) | |_) |
    \/ /_/ \__|_|_|__/ \/ \/___/|_._/

    Welcome to Darwin!

    $ cd /var/db
    $ ls
    BRLM.db SystemKey lockdown
    BootCache.data SystemKey-orig mds
    BootCache.playlist bluetoothEnabled ntp.drift
    CodeEquivalenceCandidates crls openldap
    CodeEquivalenceDatabase dashboardadvisory.database receipts
    DetachedSignatures dhcpclient samba
    DirectoryService dhcpd_leases shadow
    PanicReporter dslocal shadow-backup.xar
    PreviousSystemFiles.plist dslocal-backup.xar smb.conf
    QuickTimePlayerVersion.plist dslocal_orig.cpgz statd.status
    RemoteManagement dyld sudo
    RosettaVersion.plist krb5kdc vmware
    Spotlight launchd.db volinfo.database
    SystemEntropyCache locate.database
    $ vi locate.database
    $ locate ical
    $ ls -l locate*
    -r--r--r-- 1 nobody wheel 14730259 2010-11-02 09:28 locate.database
    $