How to disable the "locate" command in Mac OS?

You can disable it like this:

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

Keep in mind, this process only runs periodically to make the database that caches the results, so your locate results will be static and not change from the time you unload the "refresh task".