Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Sync with .Mac (MobileMe) from the command line UNIX
I noticed a new post on a very old thread on the Mac OS X Hints forums site, which was about being able to start a sync to .Mac (MobileMe) from the command line. The new post showed how to use an AppleScript to control the MobileMe preferences pane and then click the Sync Now button.

While this may work, I suspected that there must be a better way, and so I had a dig around. I found dotmacsyncclient, located in /System » Library » PrivateFrameworks » DotMacSyncManager.framework » Versions » A » Resources. Further investigation showed that, indeed, you can start a sync from the command line -- and much more.

Note that the following examples assume you have cd'ed into the above directory first... ...or have otherwise set things up such ($PATH) that you don't need to type the full path to the command every time. In Terminal.app, to start a sync now, use this command:
dotmacsyncclient sync
Read on for some other uses of this program, as well as a caution on its use.

To see the current sync status, use dotmacsyncclient status; this will print a report showing the exact date and time of the last sync for your data (contacts, calendars, etc.). To get a list of registered clients (Macs) on .Mac, use:
dotmacsyncclient listdmclients --u DotMacUserName
You will be asked for your password when using listdmclients. As you will be logging into .Mac, the password must be that of your .Mac account.

If you'd like to see all the things you can do with dotmacsyncclient, just type dotmacsyncclient help all. You can also get help on any particular command with dotmacsyncclient help command_name. You should note that if you do not know exactly what a particular command does, then you should not attempt to use it -- some of these commands look as though they can modify sync'ed data and change settings.

Hope this helps some of you.

[robg adds: You can make this command easier to use with a simple alias in your .profile file: And please heed Mark's warning on arbitrary use of these commands -- you can do things such as replace all the data on .Mac with that of the computer, and vice versa. If you mean to do this, that's fine ... but if you don't, you might be a little upset when it happens.]
    •    
  • Currently 2.31 / 5
  You rated: 4 / 5 (13 votes cast)
 
[19,564 views]  

Sync with .Mac (MobileMe) from the command line | 14 comments | Create New Account
Click here to return to the 'Sync with .Mac (MobileMe) from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Sync with .Mac (MobileMe) from the command line
Authored by: mmnw on Sep 02, '08 08:06:16AM

Wonderful Hint. I really appreciate it.
I always found the default sync schemes too restraining. Sometimes even annoying. I guess with a little time and some shell and launchd magic one could prepare his own sync scheme....
Would I have known this some weeks ago ... I had a note in Mail.app on my home computer and needed it on my laptop, but for some weird reason the note wasn't synced. My home mac did have ssh enabled, but I didn't know how to start the sync. I finally enabled the screen sharing feature ... This hint would have solved it so much more easily...



[ Reply to This | # ]
Sync with .Mac (MobileMe) from the command line
Authored by: osxboy on Sep 02, '08 08:10:50AM

Is this 10.5 only?



[ Reply to This | # ]
Sync via AppleScript -- finally!
Authored by: TF on Sep 02, '08 12:21:14PM

I have been asking and looking for a way to sync .Mac/MobileMe from a script for ages. Thanks! Great to finally have in the database.



[ Reply to This | # ]
Sync with .Mac (MobileMe) from the command line
Authored by: notmicro on Sep 02, '08 01:42:46PM

When I tried the "status" command it didn't work; I had to use "syncstatus".



[ Reply to This | # ]
Sync with .Mac (MobileMe) from the command line
Authored by: MacMuse26 on Sep 02, '08 01:44:29PM

Now if only I could...

Last week's hint on dumping iPhone call records into an iCal calendar - Add an iPhone call log to iCal via AppleScript - had me searching for a way to kick off a DotMac sync whenever the system detected a change in my iPhone's backup files stored on the mac (i.e., an iTunes backup/sync of the phone just completed). While I found the similar script to hit the Sync menu, this will work much better. But I'm still having trouble with detected a change to the iPhone backup folder. I tried a folder action to run the DotMac sync script, but it does not fire as anticipated.

What I really wanted to mention is when will Apple change the name of the utility to MobileMeSyncManager and break this wonderful hint?

Thanks for finding this one!



[ Reply to This | # ]
Awesome! What about mobile home sync?
Authored by: phillymjs on Sep 02, '08 03:36:53PM

Anyone know if the same thing is possible with the home folder syncing of mobile user accounts? Soooo useful if I could make a bunch of machines I manage report the time of last home folder sync.

---
Need Mac support for a business in the Philadelphia, PA metro area? Contact me.



[ Reply to This | # ]
Awesome! What about mobile home sync?
Authored by: zamaterian on Oct 18, '08 10:12:30AM
you could replace apples mobileme/.mac with an opensource alternative such as http://code.google.com/p/dotmac/ and then monitor the access log for notifying when clients updates. Or since the source code is available hack it :-)

[ Reply to This | # ]
Sync with .Mac (MobileMe) from the command line
Authored by: pattulus on Oct 18, '08 11:05:07AM

Is somebody here capable of telling me how to complete this applescript…
I want to trigger it as a script via Launchbar, but it doesn't work and the terminal stays open :[

<code>
tell application "Terminal"
do script "cd /System/Library/PrivateFrameworks/DotMacSyncManager.framework/Versions/A/Resources"
delay 1
do script "dotmacsyncclient sync"
end tell
</code>



[ Reply to This | # ]
dosn't seem to work for me.
Authored by: macubergeek on Nov 05, '08 04:18:16AM

When I ssh to my mac at home I get:
jamesk@HOME/System/Library/PrivateFrameworks/DotMacSyncManager.framework/Versions/A/Resources-> ./dotmacsyncclient syncstatus
2008-11-05 07:15:04.159 dotmacsyncclient[470:10b] SyncServer is unavailable: timed out trying to connect



[ Reply to This | # ]
dosn't seem to work for me.
Authored by: fxt on Feb 09, '09 11:06:52PM

i also get a timeout errors when i ssh into a machine.



[ Reply to This | # ]
dosn't seem to work for me.
Authored by: ammon on Jul 28, '10 09:58:12PM

Access to the GUI session is required. As a workaround, if in advance you leave /usr/bin/screen running on the machine in one of its Terminal.app windows, you can ssh in and attach to it (screen -x) to run the syncclient tool.



[ Reply to This | # ]
Sync with .Mac (MobileMe) from the command line
Authored by: mael on Jun 05, '10 08:22:11AM

The command dotmacsyncclient is now replaced by /System/Library/PrivateFrameworks/DotMacSyncManager.framework/Versions/A/Resources/mobilemesyncclient. (Funny, that the directory is still named DotMac... and not MobileMe as well...)
dotmacsyncclient is a symbolic link to that file, so it continues to work. Almost though, since the syntax is now very different.
Although --help still lists the option I am unable to find a listing like the previous "listdmclients". Could anybody help?



[ Reply to This | # ]
Sync with .Mac (MobileMe) from the command line
Authored by: ammon on Jul 28, '10 10:00:03PM

mobilemesyncclient --listclients works for me.



[ Reply to This | # ]
Sync with .Mac (MobileMe) from the command line
Authored by: mael on Jul 29, '10 05:28:12AM

Thanks! Now the help also lists this option. Seems it has been updated with 10.6.4.



[ Reply to This | # ]