macos – Can autologin be set up from the command line? how?

I am attempting to automate the setup of a vsts ‘build agent' for mac, as documented here:

One recommended step, that is definitely useful in our usecase is to configure autologin (and lock), and the step links to this guide:

I've found many references to the system preferences GUI approach, which did work when I tested by hand, but few to the command line approach, which is what I would like to do for my script. Some command line approaches are outdated, with references to ‘systemsetup' which is no longer available. We are currently on 10.11, and planning to move to 10.12 at some point, so any approach for these systems would be appreciated.

I have found reference to the ‘autoLoginUser' plist setting, which I have tested. It can be set with commands like:

sudo defaults write /Library/Preferences/ autoLoginUser "buildagent"

This value IS set when the preferences are set, but it is not sufficient by itself.

Can this be done entirely from the command line, such as via a script? if so, how?

Author: Subham

Leave a Reply

Your email address will not be published. Required fields are marked *