Is there a way to sync custom shortcuts (general and application specific i.e. Xcode) between two macs?


2 Answers 2


use dropbox+symlinks

Dropbox syncs folders & files between two machines, and creates a backup on the cloud. Symlinks enable you to create links to other folders & files on your machine that need to be stored/placed somewhere other than your Dropbox folder. Sort of like desktop shortcuts on windows. Using the two together will enable you to keep any media you wish in sync between two machines, not just your Dropbox folder.

After installing Dropbox, open a terminal

ln -s /Users/yourUsername/folderIWantToSync /Users/yourUsername/Dropbox/folderIWantToSyncTo

the folderIWantToSync is probably going to be the keyboard shortcuts preferences file. Not sure where that is, but if you do this on both machines, the file will stay in sync between the two machines, thus your keyboard shortcuts (I believe this is the type of shortcut to which you are referring) will be the same on both machines.

The link below shows you how to set up dropbox with symlinks. http://iboughtamac.com/2010/05/05/symlinks-dropbox-awesome/

  • Ok thanks for the info. So I think now the question boils down to where the shortcuts are saved on the mac
    – akasi
    Commented Jun 14, 2012 at 18:25
  • This might help Aapparently different keyboard shortcuts are stored in different files. From what I have read, it seems like you should be able to sync the symbolichotkeys.plist in <your user folder>/Library/Preferences folder. Maybe there is one specific to Xcode. I don't have my mac with me at the moment, but this should get you close. Commented Jun 14, 2012 at 18:59
  • In the future, please edit your existing answer and then flag it for moderator attention to have it undeleted. No need to post two.
    – slhck
    Commented Jun 14, 2012 at 19:50

Here's a python script that will save shortcuts and dump them to a JSON file when invoked with save, then load that same JSON file, potentially on a different mac, with load.

import os
import sys
import json
from argparse import ArgumentParser

from AppKit import NSUserDefaults

defaults = NSUserDefaults.standardUserDefaults()
allDomains = defaults.persistentDomainNames()
global_defaults_name = "pbs"
global_defaults = defaults.persistentDomainForName_(global_defaults_name)
filename = os.path.join(os.path.dirname(__file__), "mac-shortcuts.json")
NSUserKeyEquivalents = "NSUserKeyEquivalents"

def save():
    apps = []

    for domainName in allDomains:
        domain = defaults.persistentDomainForName_(domainName) or {}
        keys = domain.get(NSUserKeyEquivalents)
        if keys:
                    "domainName": domainName,
                    "keys": [
                        {"action": action, "key": key} for action, key in keys.items()

    services = []

    for key, value in global_defaults.get("NSServicesStatus", {}).items():
        if "key_equivalent" in value:
            services.append({"action": key, "key": value.get("key_equivalent")})

    with open(filename, "w") as f:
        json.dump({"app": apps, "service": services}, f, indent=2)

def load():
    with open(filename, "r") as f:
        configuration = json.load(f)

    for app in configuration["app"]:
        key_equivalents = {
            NSUserKeyEquivalents: {
                each["action"]: each["key"] for each in app["keys"]
        defaults.setPersistentDomain_forName_(key_equivalents, app["domainName"])

    services = {
        "NSServicesStatus": {each["action"]: {"key_equivalent": each["key"]}}
        for each in configuration["service"]
    defaults.setPersistentDomain_forName_(services, global_defaults_name)

parser = ArgumentParser()
sub = parser.add_subparsers()

(This is better than saving to Dropbox because daemons that run in the background might randomly re-write these files; this uses the defaults system to write through the various caches that are in place.)

You must log in to answer this question.

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