defaults write -g not working remotely on El Cap?

Schooltech65
New Contributor

Greetings all,

In prior years, we disabled OS X's autocorrect features on specific machines with a script + policy that wrote:

defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false

or alternately,

defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false

This year, after upgrading to El Cap, we observed that didn't seem to work anymore, via policy or Casper Remote. I've dug into it further, and it seems that I can manipulate that (and similar) settings via the local command line, and changing those settings in the GUI or via the CLI result in the appropriate changes being reflected when checking through the other, but my remote attempts with the same syntax still fail.

I have noticed two interesting things -- those settings do not seem to exist initially, until I've opened System Preferences > Keyboard. Also, those settings appear to be user-specific. (At least, now, not sure if they were previously.)

I found a post elsewhere that pointed towards a per-user plist at ~/Library/Preferences/.GlobalPreferences.plist~/Library/Preferences/.GlobalPreferences.plist , but trying to write to that directly seems to do something bad, as defaults read -g now returns "Domain Apple Global Domain does not exist".

Anyone with similar experience or advice? I'm half tempted to try deploying a Launch Agent that will just run the default writes on behalf of the currently logged in user.

Thanks!

3 REPLIES 3

jjones
Contributor II

Looks like by manually changing the autocorrect option in System Preferences, there is one line "WebAutomaticSpellingCorrectionEnabled = 1" that is changing, using this script you should be able to change it for each user currently logged in:

#!/bin/bash

#Set arguements for script
loggedInUser=""

#Writes current user that is logged-in into terminal
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
#Setting Spelling Autocorrect to 0
su -l "$loggedInUser" -c "defaults write .GlobalPreferences.plist WebAutomaticSpellingCorrectionEnabled -int 0"

Schooltech65
New Contributor

Hmm, good idea and method for getting it to run as the user. I had to tweak it a little bit, using -g instead of .GlobalPreferences.plist, but after that, it seems to work just fine.

Thanks!

bentoms
Release Candidate Programs Tester

Have you tried this as a config profile?