I have had this problem when I have devices set to sync over wifi. It doesn't matter if I'm actually building and running or if I've just opened Xcode and am trying to edit files.
I can (usually) make it go away by removing one or two devices that connect over wifi from the list, or by plugging them in via actual wires. I don't know if that's the actual problem, or if it triggers something else deep in Xcode, but maybe the same will work for you.