Enable Guest User in 10.14.x Via the Command Line (without a MDM)? Is there a way to enable the Guest user via the terminal in 10.14.x?

I have tried...

defaults write /Library/Preferences/com.apple.loginwindow.plist GuestEnabled -bool YES


On machines where the Guest account has been previously enabled and then disabled through the System Preferences -> Users &amp; Groups GUI, this works.  

However, on a machine where the Guest account has never been previously enabled, this does not seem to work. On the Users &amp; Groups pane of System Preferences, the Guest account says "Logins Only" instead of enabled, and a Guest user is unable to login.

(I am managing a fleet of Macs without the use of a MDM, hence my desire to be able to do this without physically touching 100's of machines.)
The first time the Guest user is enabled, a new user is created with a process similar to that of any user creation.

The macOS procedure has been distilled into a script, essentially running dscl . -create /Users/Guest and other dscl configuration commands on the user.

The script is available at


https://github.com/sheagcraig/guestAccount/blob/master/guest_account


and see the readme too for notes on Keychain. This has been tested to work in 10.14.2. Note that you will have to change or remove the OS version check if using on any OS above 10.8.