1

Despite the claim made in the answer to this question:

This is exactly the behaviour I am seeing and I don't want it!

E.g.

wms:~ alan$ ls /Volumes
MobileBackups   Tamandua    
wms:~ alan$ locate /usr/texbin
/Volumes/AlanG5Backup/Previous Systems/Previous System 1/usr/texbin
/Volumes/AlanG5Backup/Previous Systems.localized/2009-07-10_1136/usr/texbin
/Volumes/MacBookBackup/usr/texbin

AlanG5Backup and MacBookBackup were partitions that I had previously mounted, but (as the output from ls /Volumes shows) were not mounted when I ran the locate command.

Furthermore, the current volume (Tamandua) doesn't show any locate results at all, which it should.

How do I fix this? I'm running 10.9.

2

locate is not equivalent to Spotlight.

Having said that, lets look at the meat of your question:

You can try to force an update of the locate db using sudo /usr/libexec/locate.updatedb which will rebuild the locates database.

I would check the manpage for locate for additional options regarding other volumes as I believe there is a flag to stay on the current filesystem from locate but it escapes me at the moment. Locate Man Page for 10.9

Having looked at it the best thing I can come up with is to use a regular expression that won't visit another filesystem or to create seperate databases for each.

Another option is to use the find command which can be told to stay on the current filesystem -x on BSD, -xdev in linux.

  • Thanks. Updating the database cleared up the problem, but it's still odd that it happens in the first place. – Alan Munn Nov 18 '13 at 15:35
  • 1
    When the locate updater run last, the external drives were attached and therefore indexed. locate just looks in the database for any matches and doesn't take mount/unmount status into account at all. – nohillside Nov 18 '13 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .