Import text snippets from Apple’s Keyboard System Preferences

Can TypeIt4Me import text replacement snippets from Apple’s Keyboard System Preferences?

Screenshot of Apple Keyboard text replacements in system preferences

 

Yes, it can, with a little help from you. A number of people have contacted us to say they find the way Apple syncs its “native” Mac and iOS text replacement snippets between devices to be unreliable. We’ve been asked how to convert these snippets into a format that can be imported into TypeIt4Me in order to use them in our app and sync via iCloud Drive. The conversion process involves a few steps, which we’ve detailed below.

  • Decide on a filename for the Apple text replacement snippets you’re going to export, then launch the Terminal app and type:
    touch [your choice of filename].txt
    (without the square brackets)
  • Press return or enter.
    The above command will create an empty text file in your Home directory, ready to receive the output from subsequent commands you will be executing in a minute.
  • Hold down the alt (option) key on your keyboard, then go to the Finder menu at the top of your screen, click on Go and select Library.

 

Screenshot of Library revealed in the Finder menu

  • In the Finder window that opens, type “userdictionary.db” into the Search field. Then click on “Library” where you see it next to “Search: This Mac.” You should see at least one or possibly several UserDictionary.db files in the list of search results:

Screenshot of Finder search results for userdictionary.db

  • Go back to Terminal and type sqlite3 and a space.
    Do not press return or enter yet.
    Screenshot of the Terminal window
  • Drag the “UserDictionary.db” file with the largest file size (that you found in the Finder search) and drop it onto the Terminal window. This will produce something resembling the following (with your own username instead of johnappleseed, of course):
    Screenshot of Terminal window
  • Now go ahead and press return / enter. You’ll see a sqlite prompt as shown here:
    Screenshot of Terminal window
  • Copy and paste the following lines into Terminal one by one, pressing return / enter after each one:
  • .separator “\t”
  • .output [your choice of filename].txt
  • select zshortcut,zphrase from zuserdictionaryentry;
  • Now open the [your choice of filename].txt file that was saved earlier to your Home directory and it should contain the exported system preferences text replacements.
  • To use it with TypeIt4Me, simply drag and drop this file onto the Sets on this Mac pane of the main TypeIt4Me window.