This list, the one accessed by System Preferences/Keyboard/Text, vanished when I updated to 10.9.2 (it survived the initial update to Mavericks). I do a lot of writing for the sciences, and I've spent years building that list. (recent MacBook Pro, 10.9.2).

Some sites say I should get the /Users/username/Library/Preferences/.GlobalPreferences.plist file from a backup, but I've searched the HD of my other computer (same specs but running 10.9.1, Replace/With list intact), and I can find no such file.

Other sites say it's in the "NSUserDictionaryReplacementItems array" in 10.9, but unfortunately I don't know what that means. (I'm a user, not a programmer.)

I've heard that it may be linked to Mavericks' new ability to sync this list to iOS devices, but that still doesn't explain why I can't find it on my 10.9.1 machine, which has been syncing to my phone (iPhone 4, iOS 5.x) for years.

4 Answers 4


In 10.9 the text replacements are also stored in ~/Library/Dictionaries/CoreDataUbiquitySupport/$USER~*/UserDictionary/local/store/UserDictionary.db. UserDictionary.db is used even if iCloud is disabled and it has precedence over .GlobalPreferences.plist.

If you for example run defaults write -g NSUserDictionaryReplacementItems '({on=1;replace=aa;with=bb;})' and quit and reopen TextEdit, aa is replaced with bb in TextEdit, but the changes are reverted if you open the Text tab of the Keyboard preference pane.

You can change both UserDictionary.db and .GlobalPreferences.plist by using a script like this:

date=$(date +%s)
while read -r replace with; do
  sql+="INSERT INTO 'ZUSERDICTIONARYENTRY' VALUES($((++i)),1,1,0,0,0,0,$date,NULL,NULL,NULL,NULL,NULL,\"$with\",\"$replace\",NULL);"
done < <(sed 's/\\/\\\\/g;s/"/\\"/g' ~/replacements.txt)
sqlite3 ~/Library/Dictionaries/CoreDataUbiquitySupport/$USER~*/UserDictionary/local/store/UserDictionary.db "delete from ZUSERDICTIONARYENTRY;$sql"
defaults write -g NSUserDictionaryReplacementItems "(${plist%?})"

In 10.8 and earlier versions of OS X the text replacements are stored in the NSUserReplacementItems array (not NSUserDictionaryReplacementItems) in ~/Library/Preferences/.GlobalPreferences.plist.

  • How exactly does that script work? How and when should I run it? Can you expand your answer with a few more details on this? I got everything working just like I want by editing the file manually, but like you said, opening System Preferences wipes out my custom items. Commented Oct 21, 2014 at 18:27
  • @CodyGray The script reads file replacements.txt in your home directory and inserts replacement definitions from this file both into .GlobalPreferences.plist and UserDictionary.db. Each line of the file should contain exactly two words: what_to_replace replace_with separated by whitespace.
    – Mr. Tao
    Commented Jun 25, 2015 at 20:55
  • This appears to be failing in macOS 10.13 (High Sierra). I'm still hunting for an alternative.
    – gerwitz
    Commented Jun 13, 2018 at 7:01

I found an easier way to do it.

Use these steps to export your existing text substitutions:

  • Open System Preferences > Keyboard > Text.

  • Select the shortcuts you want to export. If you want to export all of your text substitutions, select one of them, then choose Select All from the Edit menu.

  • Drag the selected shortcuts to the desktop. This creates a file name Text Substitutions.plist that contains the substitutions you selected.

  • Close the System Preferences window.

Use these steps to import the plist file you created in another user account:

  • Copy the plist file you previously created to the /Users/Shared/ folder, or to an external drive.

  • Log in as the user account where you want to use these text substitutions.

  • Open System Preferences > Keyboard > Text.

  • Drag the Text Substitutions.plist file to the area of the System Preferences window where the text substitutions are shown (under Replace or With).

  • Close the System Preferences window.

source: https://support.apple.com/en-in/guide/mac-help/mchl2a7bd795/mac


The preferences are stored in NSUserDictionaryReplacementItems in ~/Library/Preferences/.GlobalPreferences.plist.

You can read the contents by opening the file and looking through it, or by running:

defaults read -g NSUserDictionaryReplacementItems

To copy your preferences to another machine, take the output of the previous command and run the following command to write your settings:

defaults write -g NSUserDictionaryReplacementItems -array-add '{on=1;replace=foo;with=bar;}'

Replace the contents of the array at the end of the command with the replacements that you want.
-array-add appends to the end of the array. Use -array to replace the entire array.

  • Thanks for your help. You began by saying I can read the contents by opening that file, but I can't find that file. (...and I don't know what "NSUserDictionaryReplacementItems" is...not a GUI item or file/folder heierarchy thing, I assume? A command-line thing in UNIX?) I’m not comfortable typing in Terminal (I’m a computer user, not programmer), but I have a friend who might be able to come over and help me with that in a week or so. In the mean time, is there a way to find that .plist file using the Finder? Thanks again!
    – user72789
    Commented Mar 12, 2014 at 14:39
  • @user72789 Since the file starts with a dot, the file is hidden by default. You need to show hidden files in Finder (defaults write com.apple.finder AppleShowAllFiles -bool true && osascript -e 'quit app "Finder"') or open it through Terminal. NSUserDictionaryReplacementItems is an array in the file along with other data. This is why it may not be desirable to copy the entire file, hence my Terminal commands in the answer.
    – grg
    Commented Mar 12, 2014 at 15:09

I've written a script for backing up and restoring the database. There is no need to extract anything from .GlobalPreferences.plist, just copy the db and open the systeme preferences to reload the settings.




# Find the path where the replacement DB is:
UUID=$(defaults read "$PLIST" APNSTokens_Production|grep -E '^\s*"[0-9A-F-]*"'|cut -d\" -f2)


function Backup(){
    echo "Backup"
    [ \! -d "$DB_BACKUP_DIR" ] && echo "Backup directory does not exist" && echo "$DB_BACKUP_DIR" && exit 1
    echo "Copying database file"

function Restore(){
    echo  "Restore"
    [ \! -r  "$DB_BACKUP_FILE" ] && echo "Cannot read the backup file" && echo "$DB_BACKUP_FILE" && exit 1
    [ \! -d "$DB_RESTORE_DIR" ] && echo "Creating Restore Directory" && echo "$DB_RESTORE_DIR"
    echo "Copying database file"

    # The database has been copied, but OS X ignores it
    # until the tab System Preferences \ Keyboard \ Text is opened at least once
    # Use osascript to open and close System Preferences \ Keyboard \ Text
    osascript - <<EOC
 tell application "System Preferences"
    set the current pane to pane id "com.apple.preference.keyboard"
    reveal anchor "Text" of pane id "com.apple.preference.keyboard"
end tell


# Main
case "$1" in
-b)  Backup
-r)  Restore
 *) echo "Usage: $0 -b|-r"
    echo "\t\t-b: backup"
    echo "\t\t-r: restore"
    exit 0

You must log in to answer this question.

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