Tuesday, February 23, 2010

blued process is killing my CPU

My development system is a MacBook Pro running OSX 10.5.8.  Just last month the blued process went haywire on me.  It was consuming about 40% of my CPU -- no bueno. For those who don't know, blued is the Bluetooth daemon.  Here's what I did to fix it, YMMV.

At the time, I didn't have time to dig into the problem, so I renamed the /usr/sbin/blued file to /usr/sbin/blued.bad and then used the activity monitor to 'force quit' the blued process.  If that doesn't work, 'sudo kill -9 ' from the terminal will do the trick.  This gives you your CPU back, but your bluetooth will be b0rken.

I finally got around to debugging it by running the blued daemon in the foreground.  From the terminal I ran sudo /usr/sbin/blued.bad and saw a bunch of ouput like:
...
[_setUserPreference] syncs returns false
...

This clued me in that there might be something wrong with a plist preference file.  Since I've had multiple devices attached/detached from my system (including tethering an internet connection via my buddy's iPhone, and hacks to transfer files to/from my Motorola phone) this is not real surprising. I didn't narrow it down to a specific file but I renamed the following files:

/Library/Preferences/com.apple.Bluetooth.plist
~/Library/Preferences/com.apple.BluetoothFileExchange.plist
/var/root/Library/Preferences/blued.plist

to .bad so they would be recreated from scratch when blued is restarted.  WARNING: you will probably have to re-associate all your bluetooth devices if you do this.  (I already had deleted all my devices -- thinking that might fix the problem)

Once the preference files had been renamed then I renamed /usr/sbin/blued.bad back to /usr/sbin/blued. OSX launchd daemon finds blued and automatically started it.

After this I re-associated my bluetooth devices, and I'm back in business!

2 comments:

MRT said...

Thanks for that. Works for me for now...

Anonymous said...

Fantastic solution my friend. This was really causing me problems and yours was the only solution I found that worked like a charm. Gracias!