Automatic iPhone sync without iTunes

related: iphone , itunes , isync , apple , mac

I run iTunes about once a month.  Which means my iPhone doesn’t sync very often.  I hate iTunes.  But I like syncing!

So let’s do this: automatic hourly syncing without launching any graphical applications.

Macs have a little secret.  iSync.  iSync won’t sync with your iPhone, because it’s stupid, but it will get you there with some canoodling.  Run iSync, go to preferences, and select ‘Show status in menu bar’, you will get a spinning arrow icon in your menu bar.  The ‘Sync Now’ option from that menu will sync with your connected iPhone; just calendar and contact information (not music), but that’s all that matters anyway.

OK, so you have this icon that will manually sync without running iTunes.  But that requires clicking on things.  And fuck clicking on things.  We can do it in cron.  WE’LL DO IT LIVE!

How?  Bring up your terminal.  Run “Sync Now”, and quickly execute…

ps auxww grep -i sync

…in your terminal, before it finishes syncing.  You probably see three *Sync applications running: AddressBookSync, AppleMobileSync, and iCalExternalSync.  Copy-n-paste those three extremely long commands into a text file.  Add a shebang and a /bin/bash and name it with a .sh.  That’s a bash script, my friend.

Why don’t I just give you the script?  Because the command line depends on the device ID of your phone.  A long hex string.  It’s unique to your phone, so you need to get it.  Easiest way is through that ‘ps’ command above, though you could use the Xcode Organizer or Tiny Umbrella instead.

So once you have the command, your bash script will look something like this:


/System/Library/Frameworks/AddressBook.framework/Resources/ –oneshot –sync –entitynames,,, Address,,,, Number, Name,, Address,

/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/Current/ –oneshot –sync <YOUR IPHONE IDENTIFIER> –entitynames,,,,,,,,,, Address,,, Number, Name, Address,

/System/Library/Frameworks/CalendarStore.framework/Resources/iCalExternalSync –sync –entitynames,,,,,,,,,,,,,,,,

And then you just call that from cron.  Name it something like…  Edit your crontab:

crontab -e

And add a job to run once an hour:

0 * * * * /Users/trevor/Documents/Scripts/shell/

Bingo!  Silent, automatic, hourly, two-way synchronization between your Mac and your iPhone.

Oh yeah, you can vanish that iSync icon from your menu bar now.

[mine is an iphone 3gs.  mine is an os x 10.6.6.  mine is an ios 4.2.1.  mine is jailbroken.  your might not work.]