8

I tend to keep all my stuff in Dropbox. Now that I bought a second Mac, I thought that keeping also my applications preferences in Dropbox would have been a good idea.

I managed to sync some of the Application Support folders (I just want the more important apps to be in sync) by simply linking the shared folder on Dropbox to the link on the Macs:

ln -s ~/Dropbox/SharedPrefs/AnApp ~/Library/Application Support/AnApp

this way I ensure that every, say, Sublime Text 2 build I create on one Mac will be synched on the other Mac.

But I'm having troubles in synching actual .plist files. I did the exact same thing as above (the example is for iTerm 2):

mv ~/Library/Preferences/com.googlecode.iterm2.plist ~/Dropbox/SharedPrefs/
ln -s ~/Dropbox/SharedPrefs/com.googlecode.iterm2.plist ~/Library/Preferences/com.googlecode.iterm2.plist

So now I have the actual physical .plist file on Dropbox, and a placeholder link on the Mac.

But this doesn't seem to work: when I quit and re-open iTerm (or whatever application), it isn't able to use the symlink to access the preferences on Dropbox.

What should I do?

I'll appreciate every advice on how to keep application preferences synched between two Macs; I'm using the cmd-line just because I'm used to it but also a GUI utility is ok. Also, an utility which doesn't sync only the Application Support folder, but also the .plists and other shared stuff would be great!

1
  • I guess if iTerm doesn't follow symlinks, you'll have to ensure that on each machine the file in the Dropbox is the symlink.
    – asmeurer
    Jan 11, 2014 at 17:42

4 Answers 4

9

Open preferences and check the box marked "Load preferences from a customer folder or URL""

You can browse to your Dropbox folder and the click "Save Settings to Folder"

example

3
  • How can I turn all this off please !? And I don't see what you do in system prefs :-(
    – JRP Media
    Nov 26, 2014 at 19:49
  • These are iTerm2's preferences. That app specifically has an option for preferences location. How can you sync any app's preferences?
    – Bluu
    Jul 22, 2017 at 17:35
  • I am not aware of any generic method to sync app preferences for ALL installed apps. You could attempt symlink hacks, or other ideas presented here. Unfortunately, those solutions can be rather fragile. I've had great results sync'ing settings when using built-in application-specific functionality (provided by the application vendor) or via 3rd party application-specific plugins. ITerm2, VSCode, and Sublime Text are great examples of apps that do so. Jul 24, 2017 at 19:41
3

Confirming that Kevin's answer above also works via iCloud Drive sync in High Sierra.

I did the following:

  1. Create a folder called "Sync" directly in iCloud Drive (as a sibling to Documents)
  2. Create another folder called iTerm2 within Sync (presumably I will do this with other apps, hence the folder structure)
  3. Point iTerm2 there via its Preferences. It will ask you if you want to place a current copy of the plist file there.
  4. Repeat step #3 on all other systems where you want to use iTerm2

Note that there can be some latency with iCloud Drive sync, but it does work.

1
  • I have one observation (I've used this mechanism for many years - saving in a Dropbox folder). One thing I do is set the "Save changes to folder when iTerm2 quits" flag on just one of my machines. That's because I have found that if I have it set on all my machines, I might save settings on one machine then accidentally overwrite them when I stop iTerm on one of the other machines. Oct 15, 2020 at 3:26
1

You could set up a folder action item that monitors the relevant folders and runs an Applescript that copies the relevant preference files to the Dropbox folder when the folder changes.

Another (similar) approach would be writing a launch agent:

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
     <key>Label</key>
     <string>com.yourname.yourapp</string>
     <key>Program</key>
     <string>/Users/yourname/path/to/your/script</string>
     <key>ProgramArguments</key>
     <array>
         <string>script</string>
     </array>
     <key>WatchPaths</key>
     <array>
         <string>/path/to/preferencefile1.plist</string>
         <string>/path/to/preferencefile2.plist</string>
     </array>
 </dict>
 </plist>

Save this as a com.yourname.yourapp.plist file then copy it to ~/Library/LaunchAgents/. Load it in launchd using

launchctl load ~/Library/LaunchAgents/com.yourname.yourapp.plist

start it: launchctl start com.yourname.yourapp

Now the launchd agent will run the script /Users/yourname/path/to/your/script every time "preferencefile1.plist", "preferencefile2.plist", etc, are changed.

For example "script" could be something that copies the preference files to the dropbox folder.

Another launch agent should be set on the other machine to monitor the files in the dropbox folder and copy them to the correct location when they change.

0

Another way, which would be useful for other kinds of files or other programs, is to use hard links instead of symbolic ones. Use "ln" instead of "ln -s". Beware - a hard link is very different than a symbolic. A sym link is just a pointer to the file. You can delete the link and the file is untouched. A hard link is a duplicate entry for the file in the disk's directory. It's as if the file were really in two places at once. A program can't tell any difference between the two. If you trash the link it deletes the actual file. These are so different that using the same name for both should probably not have been done.

1
  • A program that open a file can't tell the difference between a hard or soft link
    – mmmmmm
    Jun 13, 2014 at 17:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .