Is there any way to programmatically log a user on to a MAC?

I am aware of CGSession which can be used to jump to the login window or bring up the login UI for a specific user but is there a way to do this completely programmatically from a root process?


Kind regards,

Aaron.

I am aware of CGSession which can be used to jump to the login window or bring up the login UI for a specific user …

Not via its supported public API it can’t!

but is there a way to do this completely programmatically from a root process?

That depends on your specific requirements. There’s certainly no way to create a GUI login session out of thin air. There are, however, some options:

  • You could start a remote session via VNC.

  • If the GUI was parked at the login screen, you could use an authorisation plug-in to provide the password.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
@awilson, Were you able to achieve this?
Is there any way to programmatically log a user on to a MAC?
 
 
Q