I'm trying to run SlimerJS in headless mode so that it does not open a visible browser window on Mac OSX.

According to the SlimerJS docs, this can be done using xvfb which is "available on Linux and MacOS", using the command:

>> xvfb-run ./slimerjs myscript.js.

Although OSX comes with bundled with xvfb, it does not have the corresponding xvfb-run script.

How can I get the same functionality using the OSX xvfb version?


1 Answer 1


You can try something like the following (works for me with running my python test cases):

$ Xvfb :1337 & export DISPLAY=:1337 & ./slimerjs myscript.js.
  • 5
    Will be good if you can provide some explanation of what this command will do.
    – VL-80
    Aug 26, 2015 at 20:57
  • 1
    Not an xvfb expert, but Xvfb :1337 starts an "x-window virtual frame buffer" (xvfb), which will pretend to be a window server, but will not write anything to a screen) listening on port 1337; export DISPLAY=:1337 sets the DISPLAY env variable to that same port number - so X applications send their screen commands to that port; ./slimerjs mysript.js calls the application, which will believe to be writing on the screen, running headless as we want.
    – chesterbr
    May 5, 2016 at 19:34
  • (it could be any port, but @mweppler seems to be a leet person :-) )
    – chesterbr
    May 5, 2016 at 19:36
  • I think xvfb-run also kills the Xvfb process after running the process, maybe a killall xvfb at the end would be helpful ?
    – keisar
    Jan 27, 2017 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.