5

How to enable “Allow Guests to log in to this computer” option on Mac OS X 10.8 (Mountain Lion) via command line?

Hennes
  • 64,768
  • 7
  • 111
  • 168
  • 1
    There are quite a few things going on in the background when you tick the box. Not easy two wrap this all up in one or two lines of code. Is there a specific reason you need to do this via command line? – slhck May 19 '13 at 14:13
  • @slhck Yes, I am planning on automating the installation of my workstation. How about with Apple Script ? – David Andreoletti May 20 '13 at 00:48

1 Answers1

4

The option "Allow guests to log in to this computer" is stored as "GuestEnabled" key in /Library/Preferences/com.apple.loginwindow.plist

You can change it by using defaults command with root permission, tested on MountainLion 10.8.4

Read

sudo defaults read /Library/Preferences/com.apple.loginwindow GuestEnabled
#1 -> Enabled, 0 -> Disabled

Write

sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool YES|NO
hewigOvens
  • 214
  • 2
  • 4
  • This does not work on 10.14.x for devices that have never had the Guest account previously enabled. I posted a question in regards to this and 10.14 on Ask Different at https://apple.stackexchange.com/questions/346088/enable-guest-user-in-10-14-x-via-the-command-line-without-a-mdm – Tim Dearborn Dec 18 '18 at 22:26