Simulate user login using command-line utilities Sometimes, I need to create a login session (create windowserver instance, run login items / launchagents) of an admin user, because a lot of software cannot be run under root (but can be run as another user using sudo -u &lt;admin user&gt; &lt;path to app executable&gt; (which requires a windowserver instance of that user or else it will hang every few seconds)), and I don't want to spend a minute logging into another user, waiting for everything to load, and then log back to root. How would I simulate a real user login in command-line?
To quickly switch between accounts/logins, enable and use Fast User Switching. First login will (of course) take a while as usual, but afterwards switching is very quick. And unless you run big CPU-hogging applications in several accounts at once the additional resource needs are minimal.