iTunes and XCode not recognising devices after disconnected, until restart

Solution 1:

Using the following in Terminal is an alternative to resting your Mac.

sudo launchctl stop com.apple.usbmuxd

You still have to quit and relaunch iTunes or Xcode in order to see the device.

Solution 2:

(I wrote the blog post referenced by Andy Dent) in my case, my phone and iPad are connected directly to the computer (the iPad doesn't get enough juice from the hub to charge otherwise). So, I don't think it is a hardware problem. I have not found the trigger yet and despite my blogged solution, I still have to reboot at least daily as the problem comes back each time.

Solution 3:

A partial answer has been found in this blog posting and many others suggesting removing /var/db/lockdown folder contents.

I found it after experimenting with replugging devices and looking in the console log to find errors such as:

sbmuxd[55]: AMDeviceConnect (thread 0x100781000): Could not connect to lockdown port (62078) on device 790 - eef3e6e83a5e15057e68f8e09c940fa5fa11bbde: 0xe8000084.

When I restarted after emptying /var/db/lockdown I had a new prompt in iTunes for each device:

Do you want to allow this computer to access information on “AndyD6plus”?

If you don’t allow access, you will not be able to manage or sync your iPhone with this computer.

After going through those alerts, entries were created in the lockdown folder and I now seem able to remove and add devices!

Update

I think I've also worked out what triggers this behaviour - once it goes bad it stays bad. My USB hub in the keyboard has a distinctly loose port on one side. I noticed that USB sticks also don't tend to register and sit solidly in this port. I forgot and put an iPhone cable in there. When I put some tension on that cable, shuffling the mess of devices on my desk, that iPhone vanished and then the lockdown problem came back.

So I am fairly comfortable with the idea that this is a combination problem - you start with a hardware vulnerability of a dodgy cable or port and then the OS can't cope with some resulting bad data in lockdown.

Lint Update Two factors have recently come to light - firstly being that the Lightning connector has an awesome capacity to both attract pocket lint and to mostly continue working. A thread on a local Slack recently discussed this with someone posting a photo of the amount of lint they had pulled out (using a wooden toothpick). I said I had got more out the previous week from mine and that was the second go in a couple of weeks. Unless your connector is pushing all the way in with a click you probably have some lint down there. Another giveaway is if the connector can rock slightly in the port. Note that a port which is considerably blocked will still charge OK.

Apart from that, restarting the iPhone is reliably fixing the issue for me as of 9.3.x