Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to build up a database of information about system and user files on Mac OS, perhaps along these lines:

time sudo find / -type f -or -type d  -exec stat -f "{}||%p||%u||%g" "{}" \;

On one of my Linux VMs (not hosted on my laptop), a simple sudo find / is very fast, and a sudo find / -exec stat ... takes about 2.5 minutes. On my MacBook Pro with an SSD drive, a simple sudo find / takes about 2 minutes and a sudo find / -exec stat ... takes about 12 minutes.

I have an older Mac without an SSD drive, and I periodically find myself killing find processes that the antivirus software has started up because they cause the drive to churn and the system to become less responsive, and I'd like to avoid this kind of performance hit if possible.

Is there an efficient, unobtrusive way to obtain stat info for most/all system and user files on a MacOS X system? Maybe the performance differences I'm seeing mainly come down to differences in hardware?

share|improve this question

When I ran this on my laptop, I noticed high CPU usage from opendirectoryd. It looks like stat is hitting Open Directory to return user and group info. On your linux box, you are probably using /etc/passwd for all this stuff, so it would be much faster.

share|improve this answer
Is there a way to disable this lookup when the command is run, without altering the state of the system? – Eric Walker Oct 26 '12 at 1:10

You must log in to answer this question.

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