My slow Mac – Mavericks, coreservicesd, IconServicesAgent, and how fs_usage saved me

My new MacBook Pro (11,3 – retina model) running Mac OS X 10.9.1 (Mavericks) has been running slow — at times. Being a geek, I like to keep the Activity Monitor running in my Dock. I watch the CPU, and have noticed sooner or later the CPU starts to hum at a low but constant rate, despite “doing nothing” on the machine. When I look for more detail, I see coreservicesd taking some 75% of the CPU and com.apple.IconServicesAgent taking about 25%. And they hum along like this.

Going along with this, I often had problems navigating the Finder. I like using column view, and I’d navigate to a folder and contents would not display. I have the status bar showing on my Finder windows, and the progress spinner would spin and spin and spin, so it was trying to display, but either never would or eventually would (like 30 seconds later). If I relaunched the Finder, that often resolved things, but only temporarily.

Restarting didn’t help either. Maybe it would break that deadlock, but it’d be back quickly.

Google turns up I’m not the only one experiencing the problem.

I tried some of the suggestions:

Trash the ~/Library/Preferences/com.apple.finder.plist and restart the Finder. Didn’t seem to help, but didn’t hurt either.

Trash /Library/Caches and ~/Library/Caches. Again, didn’t help, but no harm (and it cleaned out a lot of cruft — they are caches after all, so no harm).

Finally, I found something:

sudo fs_usage -f pathname -w com.apple.IconServicesAgent | grep open

Very geeky, I know. I’ve used fs_usage in the past for numerous things, but hadn’t thought to use it for this problem. I’m glad I did. I saw many entries like this:

15:32:08.065782 open F=4 (R_____) . 0.000005 com.apple.IconSe.4295
15:32:08.066899 open F=4 (R_____) /Applications/Xcode.app 0.000008 com.apple.IconSe.4295
15:32:08.066933 open F=4 (R_____) /Applications/Xcode.app/Contents 0.000009 com.apple.IconSe.4295
15:32:08.066965 open F=4 (R_____) /Applications/Xcode.app/Contents/Info.plist 0.000010 com.apple.IconSe.4295
15:32:08.067690 open F=4 (R_____) /Applications/Xcode.app/Contents/Info.plist 0.000008 com.apple.IconSe.4295
15:32:08.068356 open F=4 (R_____) /Applications/Xcode.app/Contents/Resources 0.000004 com.apple.IconSe.4295
15:32:08.068469 open F=4 (R_____) /Applications/Xcode.app/Contents/Resources 0.000003 com.apple.IconSe.4295
15:32:08.068509 open F=4 (R_____) /Applications/Xcode.app/Contents/Resources/English.lproj 0.000003 com.apple.IconSe.4295
15:32:08.068535 open [ 2] (R_____) /Applications/Xcode.app/Contents/Resources/Base.lproj 0.000003 com.apple.IconSe.4295
15:32:08.068952 open F=4 (R_____) /Applications/Xcode.app/Contents/PkgInfo 0.000012 com.apple.IconSe.4295
15:32:08.069000 open F=4 (R_____) /Applications/Xcode.app/Contents/MacOS/Xcode 0.000007 com.apple.IconSe.4295
15:32:08.069050 open F=4 (R_____) /Applications/Xcode.app/Contents/Library/Spotlight 0.000003 com.apple.IconSe.4295
15:32:08.069089 open F=5 (R_____) /Applications/Xcode.app/Contents/Library/Spotlight/uuid.mdimporter/Contents/Info.plist 0.000012 com.apple.IconSe.4295
15:32:08.069174 open F=4 (R_____) /Applications/Xcode.app/Contents/PlugIns 0.000003 com.apple.IconSe.4295
15:32:08.089715 open F=4 (R_____) . 0.000006 com.apple.IconSe.4295
15:32:08.090820 open F=4 (R_____) /Applications/Xcode.app 0.000008 com.apple.IconSe.4295
15:32:08.090853 open F=4 (R_____) /Applications/Xcode.app/Contents 0.000009 com.apple.IconSe.4295
15:32:08.090885 open F=4 (R_____) /Applications/Xcode.app/Contents/Info.plist 0.000010 com.apple.IconSe.4295
15:32:08.091578 open F=4 (R_____) /Applications/Xcode.app/Contents/Info.plist 0.000007 com.apple.IconSe.4295
15:32:08.092242 open F=4 (R_____) /Applications/Xcode.app/Contents/Resources 0.000004 com.apple.IconSe.4295
15:32:08.092354 open F=4 (R_____) /Applications/Xcode.app/Contents/Resources 0.000003 com.apple.IconSe.4295
15:32:08.092394 open F=4 (R_____) /Applications/Xcode.app/Contents/Resources/English.lproj 0.000003 com.apple.IconSe.4295
15:32:08.092420 open [ 2] (R_____) /Applications/Xcode.app/Contents/Resources/Base.lproj 0.000003 com.apple.IconSe.4295
15:32:08.092838 open F=4 (R_____) /Applications/Xcode.app/Contents/PkgInfo 0.000011 com.apple.IconSe.4295
15:32:08.092886 open F=4 (R_____) /Applications/Xcode.app/Contents/MacOS/Xcode 0.000007 com.apple.IconSe.4295
15:32:08.092935 open F=4 (R_____) /Applications/Xcode.app/Contents/Library/Spotlight 0.000003 com.apple.IconSe.4295
15:32:08.092972 open F=5 (R_____) /Applications/Xcode.app/Contents/Library/Spotlight/uuid.mdimporter/Contents/Info.plist 0.000011 com.apple.IconSe.4295

Just spamming that over and over, stuff in my Xcode install.

I moved Xcode.app to the Trash. The problems stopped.

So I trashed my Xcode and reinstalled it from the App Store (this is Xcode 5.0.2). And… no more problems. My Finder is actually snappier. All this time I must have had some sort of problem or corruption with my Xcode, because this is about as nicely responsive as my new MacBookPro11,3 has been since I got it.

I am not sure what happened, if somehow my Xcode got corrupted or was always from the start. But there we are.

If you’re having similar problems, don’t jump right to Xcode, but the fs_usage may turn up a lot of churn on some file(s), that trashing could resolve.

I don’t know the whole if the issue, and am very curious. But at least I’m running again. Hopefully sharing this will help add to some knowledge out there about troubleshooting this problem.

26 thoughts on “My slow Mac – Mavericks, coreservicesd, IconServicesAgent, and how fs_usage saved me

  1. Just want to stop by and say thanks for this! Hadn’t thought of using fs_usage to see if it was hanging on something, turns out MacVim was the culprit for me. Some say it’s an issue with the Finder, but surely they would’ve come with a patch for it by now? Apparently not, let’s hope Yosemite cleans this up!

  2. This is it. I’m a programmer and I’ve lost days waiting for finder on Mavericks in all kinds of weird situations, and even accidentally deleted folders which I thought were empty because the finder didn’t populate them for a whole minute (!!). The Iconserviceagent is definitely the bad boy. My problem was also related to my (up-to-date of course) XCode install, that doesn’t provide some or conflicts with other programs having registered source code file icon. Uninstalled XCode by sudo -r /Applications/XCode.app. Cleared all caches by sudo rm -r (don’t know if this is necessary). Reinstalled XCode. Problem gone. Really gone.

    Thanks so much, this took me days of work. Apple, this is a 100% Apple problem involving Mavericks and XCode. FIX IT!!! This is not something funny, it reduces productivity SERIOUSLY. To me, Snow Leopard without this bug is better than Mavericks with, just to be clear about that, forget about all your improvements if you put such grave bugs into core system elements like the Finder.

  3. This is it. I’m a programmer and I’ve lost days waiting for finder on Mavericks in all kinds of weird situations, and even accidentally deleted folders which I thought were empty because the finder didn’t populate them for a whole minute (!!). The Iconserviceagent is definitely the bad boy. My problem was also related to my (up-to-date of course) XCode install, that doesn’t provide some or conflicts with other programs having registered source code file icon. Uninstalled XCode by sudo -r /Applications/XCode.app. Cleared all caches by sudo rm -r (don’t know if this is necessary). Reinstalled XCode. Problem gone. Really gone.

    Thanks so much, this took me days of work. Apple, this is a 100% Apple problem involving Mavericks and XCode. FIX IT!!! This is not something funny, it reduces productivity SERIOUSLY. To me, Snow Leopard without this bug is better than Mavericks with, just to be clear about that, forget about all your improvements if you put such grave bugs into core system elements like the Finder.

  4. Thanks, this solved the issue that I slowed me down for 2 whole days. Xcode-6-beta5 gone, problem solved.

    • Wow. Amazing that so many problems of this are from Xcode. I wonder what’s at the root of this problem.

      Anyways, glad it was helpful!

  5. Thanks a ton for posting this.
    For me, using fs_usage pulled up Atom.app, but after trashing the app, it now appears Finder is back to being snappy.

    Thanks again!

  6. Thank you for this! Had the same problem with Xcode 6 GM. Probably wouldn’t have figured it out anytime soon without your help.

  7. Wooohooooo! Finally! After weeks of suffering from an infuriatingly slow Finder at the most inopportune times and after finding nothing on Google that helped (I was always searching for “iconservicesagent”), I finally found this post (by searching Google for “coreservicesd”) and the fs_usage command helped me pinpoint the problem.

    Surprisingly, it was Emacs.app that was causing issues for me. I was running the latest dev build and reverting to an earlier dev build fixed the problem for me.

    Thanks so much for posting this! 🙂

    • Yeah, there’s no one app that is at the root of the problem… Xcode for a lot of people, but certainly there are others (like you with Emacs.app).

      But it’s still VERY curious as to WHY it’s happening in the first place.

      Regardless, glad to be of service!

      • With regards to Emacs.app (which I downloaded from http://emacsformacosx.com/builds ), the only clue I have is that the Emacs.app builds that say “multi” in the “Built On” column are the ones that are causing the problem with coreservicesd and iconservicesagent.

        The ones marked built on “10.6.8” work just fine fine for me.

        I’m not sure what “multi” means in this context, but the script used to build the DMG for Emacs.app is here: https://github.com/caldwell/build-emacs

        I’m going to email the maintainer for that package and give him a heads up about this.

  8. AWESOME! Thank you so much! I was really afraid I was going to have to upgrade my work laptop. One question though, how did you think to try the “com.apple.IconServicesAgent”? Did you narrow it down to that? I’m just ok with unix and had never heard of fs_usage…

    • As far as I know, fs_usage is just a Mac thing.

      I tried IconServicesAgent because it was one of the processes showing as consuming extraordinary amounts of CPU. So I figured, start there.

Comments are closed.