Issue running openGL via headless mac mini

I am currently trying to use EC2 mac instances to run a CI/CD pipeline which involves running tests with electron/selenium. In order to run these tests openGL needs to be available.

Im currently getting there error on line 49 of https://chromium.googlesource.com/chromium/src/+/8f066ff5113bd9d348f0aaf7ac6adc1ca1d1cd31/ui/gl/init/gl_initializer_mac.cc.

With the output on the instance giving:

2022-06-09 19:38:25.937 Electron[52243:188559] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'ClientCallsAuxiliary': Connection interrupted [52245:0609/193826.555969:ERROR:gl_initializer_mac.cc(65)] Error choosing pixel format. [52245:0609/193826.556035:ERROR:gl_initializer_mac.cc(193)] GLSurfaceCGL::InitializeOneOff failed. [52245:0609/193826.664827:ERROR:viz_main_impl.cc(188)] Exiting GPU process due to errors during initialization

The root cause of this is there is no display connected to the mac mini. Using vnc to screen share with the host (which creates a display) fixes allows openGL to work as expected. Unfortunately this is not a solution/workaround for my use case as I will need to restart/reboot these instances after each run. I have tested this multiple times and after rebooting the instance the display is no longer present. (I have verified the displays being recognized / not being recognized with displayplacer list)

Is there any way to make the mac mini host think that it has a display without relying on physical workarounds (I dont have physical access to the machine) or use software like BetterDummy that I can't run in a script.

@Kaspesi did you ever find a good workaround for this issue? I'm having this on my macOS runner all of a sudden as well. Also with Electron. Example: https://app.circleci.com/pipelines/github/cypress-io/cypress/48247/workflows/61535fb6-f49e-47b2-8941-40b6f349ec5e/jobs/2013224

Issue running openGL via headless mac mini
 
 
Q