MacOS – Exporting Text Substitutions from Lion for Import into Mountain Lion

macossystem-prefs

I am trying to migrate to a brand new install of Mountain Lion. I am trying to migrate select data from my old Lion install. Does anybody know where the text replacement definitions in System Preferences > Language & Text > Text lie? I would like to migrate them to my Mountain Lion install.

Best Answer

Thanks to Sacrilicious identifying the actual file/key where the data is stored, I figured out how to copy the whole thing with a few Terminal commands.

Make sure you don't have System Preferences open while doing this, or it may not work!

  1. On your old install, run /usr/libexec/PlistBuddy -x -c "Print NSUserReplacementItems" ~/Library/Preferences/.GlobalPreferences.plist > backup.plist
    • This saves the substitutions to the backup.plist file in whatever directory you ran that command from (by default, your home directory).
  2. Copy that backup.plist file to your new install (I recommend your home directory for simplicity).
  3. On the new install, run /usr/libexec/PlistBuddy -c "Delete NSUserReplacementItems" ~/Library/Preferences/.GlobalPreferences.plist, then run /usr/libexec/PlistBuddy -c "Add NSUserReplacementItems array" ~/Library/Preferences/.GlobalPreferences.plist
    • This wipes the default substitution list and creates a new blank one.
  4. Again on the new install, run /usr/libexec/PlistBuddy -c "Merge /PATH-TO-BACKUP/backup.plist NSUserReplacementItems" ~/Library/Preferences/.GlobalPreferences.plist, first replacing the /PATH-TO-BACKUP/backup.plist part with the actual path to wherever you saved the backup file.

That should do it. Open System Preferences to double check, but you should have an identical copy of your text substitutions on your new install.