17

I'm attempting to automate some tests of a GUI application on a headless Mac.

I'm able to run theses tests from the terminal on a desktop Mac, and there's no issues and they run as expected (without popping up a window). However, when I attempt to run them on a headless server, I'm not able to get them to work. They error out with issues related to getting a display. (Specifically, CGLChoosePixelFormat() is returning an error.)

For our Linux platform tests, we've had similar issues, and can solve that by using xvfb to create a "virtual" display.

Looking around, it does seems like it is possible to use xvfb itself on Mac ... if you install a whole X display subsystem first. This seems rather suboptimal to me. Ideally, I'd like to test on Mac using the same display system a regular Mac uses, not a different, testing-only display system.

Is there an equivalent to xvfb for the native Mac display? That is, is there a way to launch a "virtual" display on a headless Mac server?

12
  • Virtual displays definitely exist on macOS. Commented Jul 25, 2018 at 16:23
  • serverfault.com/questions/239075/… Commented Jul 25, 2018 at 16:26
  • @JBis If you know of a virtual display on macOS which use the native Mac display system and can be used for automated testing on a headless Mac, I welcome that as an answer. However, those links don't really address the issue. The latter's answer is to install X on Mac - which is what I'm trying to avoid. What the former adds to that is about manual interaction with the GUI (remote desktop), not automated testing.
    – R.M.
    Commented Jul 25, 2018 at 16:44
  • The X-11 system is required to run any of those types of programs. Why don't you want to install it? Commented Jul 25, 2018 at 16:46

2 Answers 2

5

I don't think a xvfb-equivalent is required (Mac OS X provides the required parts).

We use EDID emulator/dummy plugs to do this on a large fleet of Mac Minis that test desktop applications. The plugs emulate a display so the GPU and associated parts of the OS activate.

The new M1 Mac Minis don't seem to require the plugs (it just works).

4

you can install it from https://www.xquartz.org/ or with homebrew by

brew install XQuartz
1
  • 4
    Once you have XQuartz installed, how do you use it?
    – slhck
    Commented May 6, 2022 at 6:49

You must log in to answer this question.

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