Fix hung Music/iTunes sync on MacOS

Most people don’t use the sync function anymore, and rely on cloud streaming. And that is fine for most people. But if you are like me, and have a carefully curated library stored uncompressed and want to listen at the full quality tracks that are not available as lossless on Apple Music, then you will end up syncing them manually to your phone as I do.

However, this technology is, well, broken. Apple is not investing any time in keeping it working as they obviously don’t care about it, so it will often get stuck at some stage of the sync, never to finish until you disconnect your phone (which doesn’t always fix it), or reboot your Mac. You cannot log out of the Mac because it tells you that an iOS operation is in progress and that you have to wait until it has finished, which it never will.

For me, when it gets into that state, I have found that sending a soft kill (HUP) to the process named AMPDevicesAgent will act as the percussive maintenance that it needs to free up the sync.

I created a function in my .zshrc to quickly reset the sync when it gets hung. sudo does not need to be used in this case.

resetiphonesync()
{
	killall -HUP AMPDevicesAgent
}

Leave a Comment