How to disable the Guest account in macOS Mojave using `dscl`?

Here is how to disable Guest user via command line

sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool FALSE

Note, re-enabling it is quick, but you need extra help if you need to set this up without the first GUI step or MDM.

  • Enable Guest User in 10.14.x Via the Command Line (without a MDM)?

You can use sysadminctl tool to query and modify sevurity status of users in Mojave.

Following command should query the guest account status:

sysadminctl -guestAccount status

And with administator permissions you should be able to disable it:

sudo sysadminctl -guestAccount off