Check & Modify AutoCorrect Settings from the Command Line in OS X
Spelling autocorrect features tend to be divisive, with Mac users usually either loving it or hating it. Most Mac users know they can easily turn off autocorrect through an OS X system preference change, but the System Preferences are only accessible from the graphical interface of a Mac. If you’re wanting to automate the enabling or disabling of autocorrect for systems configuration or setup script, you may find it useful to know that you can not only check the active status of autocorrect, but also disable and enable autocorrect from the command line in OS X by using a defaults command string. This can be great in configuration and it can also be handy for making remote changes too.
This works in all versions of OS X that include the autocorrection of typos feature, including OS X Yosemite and OS X Mavericks. The command line approach to this is obviously intended for advanced users who would have good reason to use the terminal to modify a system setting that is otherwise toggled with the “correct spelling” setting instead.
Reading the Current Autocorrect Setting in OS X with Defaults Read
Want to find out from the command line if a specific Mac has autocorrect enabled or not? Use the following defaults read command:
defaults read -g NSAutomaticSpellingCorrectionEnabled
If you see a 1, autocorrect is on, and if you see a 0, it’s off. Binary.
(A quick side note, you can replace “-g” with “NSGlobalDomain” if you want to for clarity or some other reason, all of the default commands on this page will work the same with either)
Disabling Autocorrect with a Defaults Command Line String in OS X
Open the Terminal app and enter the following defaults string:
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
The change should carry over to all apps instantly and not require a reboot, though some apps seem to be a bit more stubborn and relaunching them may be necessary. Two notable exceptions that need to be handled separately are Pages and TextEdit, which use an additional separate correction mechanism for typos and grammatical errors.
Do note this change will also appear within the System Preference panel setting, so if you turn it off in the command line then the spelling correction feature will appear off in the Keyboard settings too, and vice versa.
Re-Enabling Autocorrect with Terminal in OS X
If you decide you want to have autocorrect turned on again, simply changing ‘false’ to ‘true’ in the aforementioned command string will do the job. The full defaults syntax to re-enable autocorrect in OS X is as follows:
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool true
Again the changes will take effect immediately and not require a reboot, and the setting adjustment will carry through into the GUI based system preference panel as well.