In Mac OS X the locate.updatedb command isn’t located on a path by default, so the easiest way to access it I’ve found is to symlink it:
sudo ln -s /usr/libexec/locate.updatedb /usr/sbin/updatedb
Then you can run updatedb from anywhere, as you would on Linux. Then locate should work as expected.
updatedb locate something.txt