How can I globally disable 'Text Replacement'?

Solution 1:

Very late, but

defaults write -g WebAutomaticTextReplacementEnabled -bool false

Will disable text replacement not just in Safari but in all other apps that use that input method (e.g. Evernote).

Reboot is required (at least as of macOS 10.13.6), and the menubar checkmark UI won't visually change within each app. The change also only affects applications, and not Spotlight.

Solution 2:

Somehow I messed up the Keyboard - Text replacement database (drag & dropped a imewlconverter converted plist into the GUI).

With 100k+ entries any input becomes very sluggish (I can feel the latency), it's also been synced to iOS (same iCloud ID) which I don't want as I have iRime.

Tried to manually remove all the entries (by selecting all) and click on the - but it didn't work, all entries re-appear like ghosts after a few seconds or simply didn't work.

Disabling iCloud Drive sync (System Prefs) and retried, didn't work either. It does NOT matter (on or off syncing System Prefs).

Turned out to be: I've opened Keyboards - Text Replacement on iOS which still had the huge list of entries at the time, the action triggered an instant sync back from iOS to macOS (really!).

defaults delete -g NSUserDictionaryReplacementItems did not work for me on macOS 10.14.

Later on I figured out (thanks to find and fd), it is possible to remove all TextReplacements.db* files under ~/Library/KeyboardServices, open Keyboard - Text again to regenerate the text replacement DB files, issue resolved.

The files needs to be removed and generated

TextReplacements.db
TextReplacements.db-wal
TextReplacements.db-shm

Worked on both macOS 10.14 and 10.15.

NOTE: Last but not least, do a Reset Keyboard Dictionary on iOS devices with the huge list of entries to avoid syncing back to macOS.

IMPORTANT: be aware of iCloud sync across multiple iOS / macOS devices, the sync can be instant so the text replacement items may mysteriously come back, check every device and make sure they don't push (sync) to other devices.

Mission accomplished.