17

I've been looking for an answer to this question for a while, so I'm guessing this can only be solved with a console command.

What I want to do is disable 'Text Replacement' everywhere on my Mac. The trick is, I have a library of text replacements that I use on my iPhone (like ill > I'll), and apparently it's synced to my iCloud account. As a result, if I make changes in one place it affects all of my devices everywhere - making the easy solution of "delete all of the text substitutions from your substitution library" is unavailable.

The text replacement I'm referring to specifically is the option you can disable by right-clicking on any text input area, then selecting 'Substitutions < Text Replacement' (see image).

Disabled 'Text Replacement'

I know you can disable this one field at a time by right-clicking fields and unchecking 'Text Replacement', but it is enabled by default for every individual input on every field for every application (including the entire internet and my browser's search/address bar), and it periodically gets re-enabled on some inputs.

I've already disabled 'Correct Spelling Automatically' from my system text options. (see image)

Disabled 'Correct Spelling Automatically'

And still I have to disable 'Text Replacement' on every field or it will try to correct my typing with entries in that dictionary.

I use iCloud tabs, handoff, and a number of Apple's other "Better Together" features (and I don't want to lose the ability to track my devices with 'Find my [device]'), so I don't want to disassociate my iCloud account from my computer or devices, but I'd be really happy if I never had to disable 'Text Replacement' on an input field again.

Any suggestions or ideas would be greatly appreciated!

EDIT: I've found https://apple.stackexchange.com/a/217387/172938 and https://apple.stackexchange.com/a/121553/172938 , both of which have some console references:

defaults write -g WebAutomaticTextReplacementEnabled -bool true from the first link (for enabling 'Text Replacement' in Safari).

defaults delete -g NSUserDictionaryReplacementItems from the second link (for deleting the User Dictionary as seen in my second image).

Both pertain to my issue tangentially, but each to the opposite effect I'm looking for.

6
  • If you disable iCloud Drive, they'll stop syncing between devices. Not sure if there's a more granular setting within iCloud Drive (e.g. just unchecking System Preferences) that will prevent the syncing. Jul 28, 2017 at 21:13
  • Brian D - did you ever manage to figure this out? If so, you should post the answer so we can upvote it. Will give you some reputation points as well :)
    – J. Venator
    Feb 13, 2018 at 3:38
  • @j-venator I did not figure out any solution. I believe updating to Mac OS 10.13 eliminated the problem.
    – Bmd
    Feb 19, 2018 at 17:54
  • 1
    The problem still exists in macOS 10.13.6 High Sierra.
    – 2540625
    Aug 9, 2018 at 5:37
  • This is especially vexing for Spotlight, with no way easily to disable there.
    – 2540625
    Aug 9, 2018 at 6:29

4 Answers 4

10

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.

6
  • For those who don't know, open Terminal app and paste that line and press enter. Jul 11, 2018 at 18:32
  • 2
    This doesn't seem to have any effect for me on Mac OS 10.13.6. Not even with sudo.
    – Bmd
    Jul 13, 2018 at 19:40
  • Could you expand on what "all other apps that use that input method" means?
    – Cai
    Nov 15, 2022 at 14:01
  • Worked right away, as-is in 12.5 MacOS Monterey. This is the best answer I can never find whenever I get a new mac and decide to run it fresh/clean rather than backed-restored. Glad I came across it again!
    – purefusion
    Dec 15, 2022 at 14:12
  • Worked immediately for me on Monterey, no restart or logout needed. Apr 22 at 13:47
1

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.

0

As far as I know, there is still no good solution to this problem (as of late 2018 and 10.14.1). It was one of the first things I checked when I installed Mojave, and I was disappointed yet again.

I believe the problem is that the text replacement setting is very granular, per-window/tab. There is no per-app or global switch that will be respected. (The defaults write command described above may help in some apps/contexts, but definitely not most.) Text replacement relentlessly defaults to ON in any new window/tab, with a few odd exceptions. In apps where all the action happens in one window (e.g. Messages), you can turn it off and largely forget it, but in apps where you're constantly generating new windows/tabs, text replacement is effectively unkillable — if you have them, you will trigger them.

0

I have found this solution on the web, I am quoting: https://attonblog.blogspot.com/2019/11/disable-text-replacement-on-safari-in-mojave.html

In conclusion:

You can remove all Text Replacement settings on your Mac by running the following command:

$ echo 'delete from ZTEXTREPLACEMENTENTRY;' | sqlite3 ~/Library/KeyboardServices/TextReplacements.db

$ defaults delete -g NSUserDictionaryReplacementItems

Text Replacement will no longer occur on macOS.

It's just a delete, so if you add a setting on the iOS side, you'll need to delete the synced setting again.

1
  • Did you require a reboot? This did not immediately stop the replacement for me.
    – ruffin
    Apr 19, 2022 at 18:28

You must log in to answer this question.

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