This error appears when trying to shutdown or restart my Mac.

This can happen when an iOS device hasn't finished syncing correctly. To fix this we need to kill a process called Usbmux.

Open Terminal. Applications->Utilities->Terminal.

Type sudo killall -9 usbmuxd and press Enter.

Type in your administrator password and press Enter.

You can now shutdown your Mac.