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. Hi there
    I think this is really going to help me, but I am not quite as competent as you guys. I am experiencing exactly the same problems. Please can you tell me how I go about checking out the fs_usage thing? Do I spotlight it? Sorry to be ignorant! Very grateful for any suggestions.
    Cheers

    • “fs_usage” is a command-line tool. You use the Terminal.app for it.

      It’s a lot of geeky stuff here, and if you’re not comfortable with the command line or what’s in my above posting, it may be worthwhile to find a friend that may be and see if they can help you out.

      But basically, get into the Terminal and you’ll use commands like I outlined in the above posting. You’ll have to do some sleuthing on your own tho, since everyone seems to have slightly different specific culprits in this problem.

  2. Thanks for this! Due to a lack of good internet and custom modifications to XCode I did not want to reinstall and looked for a solution.
    It seems to me that the problem is that Finder has a hard time to open the actual icons for the files you want to look at. It seems I could fix the problem by removing the “com.apple.quarantine” from the XCode Icons. Try “ls -l@ /Applications/Xcode.app/Contents/Resources/” to see if there are any files marked as “com.apple.quarantine”. If so, remove all the attributes with “xattr -r -d com.apple.quarantine /Applications/Xcode.app/Contents/Resources”. If you want to be on the safe site just remove the attributes form the single icon files.

    Cheers!

  3. Stopped as soon as I trashed Xcode. I saw other symptoms reported here, like column view in the open/save panel not populating with data for minutes at a time. Thanks! I’m also hopeful that this may cure a recurring hang I’ve been having with the open/save panel, but that might be too much to ask.

Comments are closed.