Login user when connecting via ssh on MacOS

Short term, you will probably have to limit the logged in users to one or two since Mac OS doesn't implement a terminal services model of many remote users. Not only does your setup likely violate the explicit terms relating to Remote Desktop functionality in the software license (assuming your company didn't negotiate a custom license agreement with Apple), many subsystems, tuning parameters and scripts are designed for one primary user at a time.

Long term, you'll probably choose to re-architect your build toolset to set up some mix of:

  • a continuous integration server that builds without GUI
  • Apple's server.app and leverage Xcode server service to handle logging in to the GUI so you don't need to script and automate the local windowed session for the shared build account
  • multiple Mac for each developer so they can build locally instead of remotely.

TLDR; the system wasn't designed for 5 remote users - you'll experience oddities and issues if you run that way for long