Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.