launchd hitting every modified file every 30 seconds

I am on MacOs 10.12.5. I am trying to do high volume I/O but some task managed by launchd hits every modified disk block every 30 seconds. When this happens my high volume I/O has to compete causing a severe slow down. How do I identify the problem task?

I believe it is something to do with launchd because fs_usage -w -f diskio tells me it is. Every 30 seconds it outputs a list like this for every changed disk block in the system (apologies you have to scroll to see launchd):

14:34:33.887889    WrData[AT3]     D=0x0068c05a  B=0x1000   /dev/disk2  /Users/simon/Library/Application Support/Google/Chrome/Default/Session Storage/000430.log                                                             0.000145 W launchd.9793620
14:34:33.887893    WrData[AT3]     D=0x00549a2b  B=0x1000   /dev/disk2  /Users/simon/Library/Application Support/Google/Chrome/Default/Session Storage/LOG                                                                    0.000107 W launchd.9793620
14:34:33.887895    WrData[AT3]     D=0x00570119  B=0x1000   /dev/disk2  /Users/simon/Library/Saved Application State/com.apple.Terminal.savedState/window_2.data                                                              0.000070 W launchd.9793620
14:34:33.887897    WrData[AT3]     D=0x0056fab5  B=0x1000   /dev/disk2  /Users/simon/Library/Saved Application State/com.apple.Terminal.savedState/window_3.data                                                              0.000064 W launchd.9793620
14:34:33.887912    WrData[ANT3]    D=0x0056ffd0  B=0x1000   /dev/disk2  /Users/simon/Library/Saved Application State/com.apple.Terminal.savedState/windows.plist                                                              0.000072 W launchd.9793620

I thought it might be my McAfee anti-virus software, so I excluded the files I was writing from real-time scanning, and then tried turning it off.

I then thought it might be Spotlight search, but again excluding the volume my data files are on did not prevent this launchd task from re-accessing the files.

Running launchctl list shows a list of 327 tasks. I would love to be able to narrow this down to just one.

Whilst I am sure the task runs every 30 seconds having watched it many times, I cannot find any mention of an appropriate "30" in the configuration files. I have:

  • No mention of "30" in /System/Library/LaunchAgents
  • One mention of "30" in /System/Library/LaunchDaemons
    • com.apple.powerd.swd.plist sets ThrottleInterval to 30
  • No mention of "30" in /Library/LaunchAgents
  • One mention of "30" in /Library/LaunchDaemons
    • com.mcafee.virusscan.fmpd.plist sets ExitTimeout to 30
  • No mention of "30" in ~/Library/LaunchAgents

Although McAfee does mention "30", disabling it and excluding the files made no difference.

Any help in identifying the task which is accessing changed disk blocks would be appreciated.


I had the same problem a while back but IIRC, it turned out to be the Spotlight indexing services (mds, mdworker, etc) which are spawned by launchd.

Open Spotlight in System Preferences, switch to the Privacy tab, then drag your home folder into the window. This will cause Spotlight to ignore your home folder and all subfolders.

If you don't want to exclude all your files, create a folder specifically for this high I/O application and configure Spotlight to ignore just this folder.

For a geekier method, here are some shell commands to run that will exclude the entire drive from Spotlight indexing. I use these commands on all external USB/flash drives as soon as I can.

Touch these files at the root of the drive to exclude, so cd / for the main internal drive or cd /Volumes/USB_FLASH_DRIVE_NAME for an external USB/FLASH drive, then

sudo /usr/bin/touch .metadata_never_index
sudo /usr/bin/chflags hidden .metadata_never_index

and to stop prompting if you want to use the disk for TimeMachine backups

sudo /usr/bin/touch .com.apple.timemachine.donotpresent
sudo /usr/bin/chflags hidden .com.apple.timemachine.donotpresent