View Single Post
Hi all,

I've taken Ken's post and created the files necessary and instructions for everyone to do this themselves. You can add as many other files and folders to this process as you like. It's not limited to OF.

You must have a central, 99% uptime repository with a static IP. (I am using my personal domain at Dreamhost). I you want to this to be awesome, install Growl and the growlnotify tool, because i've included growl notifications in the script, alerting when it syncs.

"Client" refers to the client computers running OmniFocus.

Each of your client computers has a "computer name." You can find this by going to system preferences -> sharing. Ken's examples were jamethiel and hypno.

"Host" refers to the central computer (which could be running OmniFocus) which contains the Mirrors folder and hosts sync files/backups for OmniFocus refers to your static IP of your host. In my case, it's In ken's case (ken case! ha!), it's If you are using a mac, enable remote access in the sharing preferences

myname refers to your login name/account name on

Setting up the DSA keys:
Since you don't want to be entering passwords everywhere, you should generate DSA keys so your computers can freely communicate.

1. On your first client computer, open Terminal. You're now most likely in your home directory. Type "ssh-keygen -tdsa", and accept all defaults.

2. On your host computer, do the same.

3. On your client computer, open another terminal window. Type the following:
Enter your password. Just leave this window alone. We'll use it to do some cleanup later.

4. In the first terminal window, where you ran ssh-keygen, type the following:
scp ~/.ssh/

5. In the second terminal window (, type the following commands:
cat >> ~/.ssh/authorized_keys2
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys2

6. Repeat steps 1-5 for each client computer.

This will now allow you to ssh, scp and rsync from your client to host without having to enter your password.

If you're not much of a terminal junkie, you're likely using bash, the default shell. If you're using tcsh or zsh, you already know enough about what you're doing to modify the following instructions to meet your needs.

Creating the environment functions
1. Grab the file included in this post.

2. Put it in your home directory.

3. Double click it to unzip it, then delete the zip file.

4. type the following command:
mv bash_profile .bash_profile

5. Edit the .bash_profile. If you have BBEdit or TextMate installed, type bbedit .bash_profile or mate .bash_profile. If you don't, type
/Applications/ .bash_profile.

I've renamed "push-focus" and "sync-focus" to "-files" because I've modified my own personal one to sync multiple files, not just OmniFocus. Change the content in red to your own information. Also, if you didn't install growlnotify, delete the two lines in blue

username="enter your username here"
hostname="enter your hostname here"

function push-files() {
/usr/bin/rsync -vP -az --delete $* ~/Library/Application\ Support/OmniFocus/. ${username}@${hostname}:Mirrors/$(hostname -s)/OmniFocus/.
/usr/local/bin/growlnotify -m "Synced OmniFocus (push)"

function sync-files() {
if [ "$1" = "" ]; then
echo "Usage: sync-focus hostname"
echo "Syncing from $1"
rsync -avP -z --delete ${username}@${hostname}:Mirrors/$1/OmniFocus/Perspectives ~/Library/Application\ Support/OmniFocus/
rsync -avP -z --delete ${username}@${hostname}:Mirrors/$1/OmniFocus/'OmniFocus.ofocus*' ~/Library/Application\ Support/OmniFocus/
/usr/local/bin/growlnotify -m "Synced OmniFocus (sync)"

6. Save, and close the file.
7. if the process is still hanging from textedit, and you don't have a prompt, hit control-c (not command-c).

8 (I think?). Once you've saved it with your edits, type source ~/.bash_profile to reload it.

Creating the auto-syncing script
1. Grab the file included in this post.

2. Put it in your home directory.

3. Double click it to unzip it, then delete the zip file.

4. Edit it and replace your own info just like you did for the last one.

Yay! They're now fully-functional scripts. But we can't do anything with them yet...

Setting up the host:
There are better ways of folder-checking followed by folder creation and so on. I'm going for quick and dirty. We're going to manually set up the repository folders on the host computer. Assuming you still have a terminal window open connected to the host computer (if you don't, ssh and get one going)

Ok. So we're in a terminal window connected to the host.

1. Create a folder "Mirrors":
mkdir ~/Mirrors

2. Create folders inside it for each of the client computers. Repeat for each one
mkdir -p ~/Mirrors/Computer Name/OmniFocus
(e.g., mkdir -p ~/Mirrors/jmaxwell-laptop/OmniFocus)

You can now close the terminal window connected to the host.

Now the host is ready to receive the files. If you're going to sync other programs, make folders within each Computer Name folder for that program name, too. For example, I have folders for DEVONthink and OmniPlan inside each of mine.

Pushing the file up there:
1. in terminal, type push-files. The result should look something like this:
jmaxwell-mlap-2:~ jkmaxwell$ push-files
building file list ...
944 files to consider
495 100% 0.00kB/s 0:00:00 (1, 0.3% of 944)
263 100% 28.54kB/s 0:00:00 (2, 17.5% of 944)
210 100% 18.64kB/s 0:00:00 (3, 76.3% of 944)

sent 83156 bytes received 80 bytes 18496.89 bytes/sec
total size is 807074 speedup is 9.70

And if you have growl, you'll get a growl notification when it finishes.

Setting up the LaunchAgent:
Although unix folks are more accustomed to cron, it's been phased out (but still supported) in OS X, in favor of LaunchAgents (for tasks run while the user is logged in) and LaunchDaemons (for tasks run regardless of user login). We're going to set up a LaunchAgent that runs every 30 minutes. (I haven't added growl notifications to this one, but I'd like to eventually and will edit this post when that happens)

1. grab the file from this post and put it in your home directory
2. double-click it to unzip it to com.omnigroup.OmniFocusSync.plist
3. delete the left-over zip file
4. open a terminal window and edit the file. If you have BBEdit or TextMate installed, type bbedit com.omnigroup.OmniFocusSync.plist or mate com.omnigroup.OmniFocusSync.plist. If you don't, type
/Applications/ com.omnigroup.OmniFocusSync.plist.

Change the content in red to your own information.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>/Users/(enter your account name here)/</string>

5. Save, and close the file.
6. if the process is still hanging from textedit, and you don't have a prompt, hit control-c (not command-c).
7. Move the file to LaunchAgents, set permissions, and load it up:

mv com.omnigroup.OmniFocusSync.plist ~/Library/LaunchAgents/

sudo chown root ~/Library/LaunchAgents/com.omnigroup.OmniFocusSync.plist

sudo chgroup wheel ~/Library/LaunchAgents/com.omnigroup.OmniFocusSync.plist

sudo launchctl load ~/Library/LaunchAgents/com.omnigroup.OmniFocusSync.plist

As long as you didn't get an error, you've successfully set up auto-syncing on your client computer. It will now sync omnifocus data every 30 minutes. As Ken said above, you can use push and sync manually in terminal now:

This pushes the current version of your omnifocus file from your client computer (the one on which you're typing) to the host. Use this right before you're about to switch from one computer to another, go home from work, etc.

sync-files computername
This gets the latest version of your omnifocus file from your host computer and puts it on your client computer. Use this when you get on another computer, when you get home from work, etc.

If anyone has any problems, please let me know.
Attached Files
File Type: zip (869 Bytes, 307 views)
File Type: zip (953 Bytes, 295 views)
File Type: zip (766 Bytes, 284 views)

Last edited by Seņor Pantalones; 2008-01-31 at 12:14 PM.. Reason: Revised