text 4 Jul Sync your iPhone or iTouch from the Command Line

You could just run this command:

/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources/reenumerate $(system_profiler | grep -A3 iPhone | grep Vendor | awk ‘{ print $3 }’),$(system_profiler | grep -A3 iPhone | grep Product | awk ‘{ print $3 }’)

But I suggest you first get your iPhone’s Vendor ID and Product ID and then set up an alias.

  1. Get your vendor id: system_profiler | grep -A3 iPhone | grep Vendor | awk ‘{ print $3 }’
  2. Get your product id: system_profiler | grep -A3 iPhone | grep Product | awk ‘{ print $3 }’
  3. Now do a test sync:
    • cd /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources
    • ./reenumerate 0x05ac,0x1234
    • Your iPhone should now be syncing
  4. Now add an alias to this command to your ~/.bash_profile (replace 0x1234 w/ your Product ID):
    echo “alias synciphone=’/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources/reenumerate 0x05ac,0x1234’” » ~/.bash_profile
  5. And finally restart your bash session or run: source ~/.bash_profile

Now you can run synciphone from any command line on your machine and your iPhone will sync. Yay!

Note: This is definitely a hack as it just drops the phones usb connection and let’s it reconnect (This includes your usb tethered internet connection). It doesn’t harm your device in any way, but iTunes will not sync if “automatically sync when device is connected” is unchecked. I’ll look for a better solution and post it if I can find one.