I need to get several users session logged-in as soon as the computer starts. Manually I would have to log into the first user and then start switching to each one to open their respective sessions. I need to automate this process. At the end sessions must remain open so each will have some program instances running.


  • 1
    What is the specific need? Maybe there's some terminal option, I'm assuming they don't have to be aigned in GUI-vise since you can only use one user at once anyways? Mar 27, 2015 at 23:02
  • Yes they need to be individual user interactive sessions since they will be remotely accessed by users via VNC
    – SebKe
    Mar 27, 2015 at 23:17
  • Put the stuff you want to start up in the users login items? Mar 27, 2015 at 23:17
  • Yes that's already done but if the machine reboots I need to manually login to every one of the 20+ users to open the sessions. Users do not login directly to the machine they use the session via browser.
    – SebKe
    Mar 27, 2015 at 23:20
  • What kind of session are we talking about here. If they use standard screensharing to log in to a user the login items will be triggered. Mar 27, 2015 at 23:21

1 Answer 1


Assuming there are no passwords, you can have each user session open another one when starting, using CGSession. I did not try it with Yosemite, but it does work for me with El Capitan.

  1. Log in as user1.
  2. Create an empty file named “logall.sh”, in a folder where the user won’t see it.
  3. Make the file executable (open Applications/Utilities/Terminal, type chmod 777  (with the trailing space); drag the file’s icon in the Terminal window; press Return).
  4. Make the file always open with Terminal (right-click on the file’s icon; select “Open with…/Other”; check “Always open with”; select Applications/Utilities/Terminal).
  5. Open the file in TextEdit.
  6. Set the file’s contents to the following, and save:

    "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/\
    CGSession" -switchToUserID `id -u user2`

Repeat for each user except user1. Set user1 to log in automatically on startup (System Preferences/Users and Groups/Options/Automatic login/user1).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .