Skip to main content

vfb

One virtual display command for Linux, macOS and Windows, with Xvfb's command line. On macOS and Windows vfb adds a monitor that does not exist to the logged-in desktop and reports its number the way Xvfb -displayfd does; the system compositor draws it on the GPU like a real panel, with no screen plugged in. On Linux it runs Xvfb.

Linux macOS Windows
Display an Xvfb server (Xvfb on PATH, or VFB_XVFB) CGVirtualDisplay (private CoreGraphics API, macOS 12+) a monitor of the Virtual Display Driver (signed, MIT)
Display number the X display number (:N) the CGDirectDisplayID the \\.\DISPLAYn number
Needs Xvfb installed (apt install xvfb) a logged-in GUI session (a plain ssh session works) the driver, which vfb setup installs (npm's install runs it); run inside an interactive session
Lives as long as the process; vfb stops Xvfb when it stops, and the kernel stops Xvfb if vfb is killed as long as the process the monitor is attached while vfb runs and detached when it stops

Install

pip install vfb          # Python: vfb.path() is the binary; `vfb` is on PATH
npm install @jwriter20/vfb   # Node: require("@jwriter20/vfb").path(); `npx vfb`

Each carries the binary for its platform (macOS 12+ universal, Linux x86_64, arm64 and i686, Windows x64 and x86: every platform Camoufox ships). On Linux, install Xvfb too (apt install xvfb). On Windows, vfb needs the Virtual Display Driver; vfb setup installs it, and npm install runs that for you (Windows asks for an administrator once; VFB_NO_SETUP=1 skips it). With pip, or if that was skipped, the first vfb that needs the driver runs it, or run vfb setup yourself.

Usage

vfb [:N] [-displayfd FD] [-screen S WxH[xD]]... [-refresh HZ] [-dpi DPI]
    [-report geometry] [-eofexit] [-noparentwatch]
    [any other Xvfb option]
    macOS:   [-scale 1|2] [-gamut p3|srgb] [-name NAME]
    Windows: [-scale S] [-match ID]
vfb setup [-count N] [-mode WxH[@HZ]]...   (Windows)
vfb list [-match ID]                       (Windows)
vfb detach N                               (Windows)
  • Every option of Xvfb's command line is accepted with its values, so a command line written for Xvfb runs unchanged (tests/xvfbopts.py checks all 91, from one option table the three builds share). The ones a virtual monitor can honour take effect; the rest are accepted and ignored. -I ends the options, as in Xvfb.

  • -screen can be given more than once, one display per screen, all held by the one vfb; the first line of output names each display number, in screen order. To give displays different refresh rates or scales, run one vfb per display: any number can run at once.

  • -displayfd FD writes the display number and a newline to FD once the display is up at the asked-for mode. Without it the number goes to stdout. On Windows only 1 (stdout) is supported, since a child inherits no other descriptor.

  • -report geometry makes the line N X Y W H SCALE: where the display sits on the desktop (points on macOS, pixels on Windows) and its scale: the backing scale on macOS, the system's display scaling (effective DPI / 96) on Windows. A browser window that fills the display is W x H CSS pixels on macOS and W/SCALE x H/SCALE on Windows.

  • -eofexit stops vfb when its stdin closes. This is the graceful stop on Windows, where a console-less child gets no signal; it lets vfb detach the monitor it attached. A launcher that holds vfb's stdin also stops vfb if the launcher dies.

  • vfb exits with its parent unless -noparentwatch is given.

  • -dpi is the panel's pixels per inch on macOS (its size in millimetres follows) and a scale of DPI / 96 on Windows.

Linux

vfb starts Xvfb with -displayfd and every Xvfb flag it was given (-nolisten tcp, -ac, +extension GLX, ...), and handles the options Xvfb lacks: -report, -eofexit, -noparentwatch, and -refresh, -scale, -gamut, -name, -match, which are ignored. With -report geometry the line is N 0 0 W H 1. Without -screen the screen is 1920x1080x24, the same default as on the other systems. vfb stops Xvfb with SIGTERM, so Xvfb removes its lock file and socket, and exits with Xvfb's status if Xvfb exits on its own.

macOS

-screen 0 1440x900 -scale 2 is a 1440x900-point HiDPI display backed by 2880x1800 pixels. The display gets the size in millimetres of a 218 ppi panel (2x) or a 109 ppi one (1x), or of -dpi, and P3 primaries unless -gamut srgb is given. A depth of 24 (the default) is an SDR display; 30 is an HDR one, which is what a Mac's 30 means to a browser: Chrome reports screen.colorDepth 30, and matches (dynamic-range: high), only on an HDR display, while Firefox reports 30 on either. (Virtual displays always scan out 8 bits per channel; HDR is what changes.) Apple silicon Macs make the HDR display: checked on macOS 15, 26 and 27. The Intel Mac tested (a macOS 15 CI VM) never does, so there vfb exits with an error rather than give a display that reports 24. Other depths are an error. With several -screens vfb runs one child process per display, since a process holds one virtual display reliably, and stops them all together.

Windows

The driver's monitors are a fixed pool, set by count in C:\VirtualDisplayDriver\vdd_settings.xml. vfb claims a free one with a session-local mutex (Local\vfb-DISPLAYn), attaches it to the right of the rightmost monitor, sets the mode and scale (-scale or -dpi, as Windows' display scaling), and detaches it on exit. vfb list shows the pool.

vfb setup downloads the driver release vfb was tested with (pinned by SHA-256), installs it, and writes the monitor count and mode list into its settings, keeping the backup of the old file next to it. The driver fails every monitor once its settings come to more than 100 modes, counting every size at its own rate and again at each global refresh rate, so setup removes the global rates and lists each mode once: the sizes real devices report most (Windows, macOS and Linux), at 60 Hz, plus the common high-refresh monitors (1920x1080 and 2560x1440 at 75 to 240 Hz, 3440x1440, 3840x2160 and 1920x1200 at 120 and 144). Your own entries in the file stay. A size or rate not in the list makes vfb run setup again with it added (vfb setup -mode WxH@HZ adds one ahead of time); 8 places are kept free for those, and the entries setup added are listed in vfb_modes.txt beside the settings, so it knows which it may drop. Setup asks for an administrator once, and restarts the driver only when the settings changed.

After the driver restarts, Windows can bring its monitors up cloned onto your own display, or switched off; vfb finds them in that state, separates them from your display, and leaves them detached. A killed vfb cannot detach its monitor; it leaves a marker in %LOCALAPPDATA%\vfb, vfb list shows that monitor as stale, and the next vfb to claim it detaches it when it stops. vfb detach N detaches one by hand.

Run vfb inside the interactive session whose desktop it extends (for automation, a scheduled task with LogonType Interactive); from a service or ssh session it finds no monitors.

Build

macos/build.sh                  # universal binary, ad-hoc signed
cd linux && CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o vfb .
cd windows && GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o vfb.exe .

Release

.github/workflows/release.yml builds the four binaries, packages them with scripts/package.py (reproducible wheels and npm tarballs, standard library only), and installs the packages on each OS. Every push to main also publishes them to PyPI and npm through trusted publishing, as the next patch of the MAJOR.MINOR in VERSION (after the highest vMAJOR.MINOR.* tag), and tags the commit with that version once both registries have it. To bump the minor or major version, edit VERSION.

Tests

tests/smoke.py SERVER (Python standard library only) opens displays one at a time and two at once, checks through the OS itself that each is up at the asked-for mode, closes them by every stop path, and checks nothing is left: no process, no display, no lock or marker, no leaked memory (macOS leaks), no growth in ColorSync's device registry. CI runs it on Linux (x86_64 and 32-bit builds), macOS arm64 and x86_64, and Windows (x64 and 32-bit builds), where vfb setup installs the driver first. CI also runs tests/xvfbopts.py on each.

macOS: display changes are spaced out

Every display added or removed makes WindowServer re-lay out every window and colorsync re-read its device registry. So vfb:

  • makes one display change at a time per user (a lock in the user's temporary directory) and leaves at least 2 s between one change and the next;
  • on exit, waits until the display has left WindowServer's online list before the next vfb may change anything;
  • gives each display a stable identity. ColorSync keeps every display it has seen as a device for good, so a new serial per run grows that registry forever and makes every later change slower. vfb's serial comes from the lowest slot no running vfb holds, so the registry holds one device per vfb that ever ran at the same time. There are 256 slots; with all of them held, vfb refuses to start (exit 1) rather than make a one-off identity that only root could remove.
  • sets the mode it was asked for. macOS remembers the last mode used for each display identity (including 1x versus HiDPI), so a slot that last ran at another size comes up in that size. vfb switches it once and reports the display only when both the size in points and the size in pixels match.

Metadata

Release files for vfb 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for vfb 0.2.1
File Actions
vfb-0.2.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for vfb-0.2.1-py3-none-win_amd64.whl
vfb-0.2.1-py3-none-win32.whl Python 3 none Windows x86-32 Details for vfb-0.2.1-py3-none-win32.whl
vfb-0.2.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux musl 1.1+ x86-64 Details for vfb-0.2.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl
vfb-0.2.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.musllinux_1_1_i686.whl Python 3 none Linux glibc 2.17+ x86-32, Linux musl 1.1+ x86-32 Details for vfb-0.2.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.musllinux_1_1_i686.whl
vfb-0.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl Python 3 none Linux musl 1.1+ ARM64, Linux glibc 2.17+ ARM64 Details for vfb-0.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
vfb-0.2.1-py3-none-macosx_12_0_universal2.whl Python 3 none macOS 12.0+ universal2 (ARM64, x86-64) Details for vfb-0.2.1-py3-none-macosx_12_0_universal2.whl

Total release size: 4.7 MB

Release files / vfb-0.2.1-py3-none-win_amd64.whl

Download URL vfb-0.2.1-py3-none-win_amd64.whl
Size 1.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
a2a2760cbf62e4df4f5bd92ed9d027aba5e21d69f4719c324ea0a5d40a6ff09f
BLAKE2b-256 checksum
How to use checksums
5b385807d7879b387390e4de3c73a7936e56f7ce8816fa22b74e850e262c413a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / vfb-0.2.1-py3-none-win32.whl

Download URL vfb-0.2.1-py3-none-win32.whl
Size 1.0 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
2585a4e117c84a358fb97a69f03bb64e4ced6663e86c177dc598d615f97ef613
BLAKE2b-256 checksum
How to use checksums
45dfcbd8fd3bab515b5f36a115994be5f6c7c02cce3c4fe59395b6e1dbf00d4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / vfb-0.2.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl

Download URL vfb-0.2.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl
Size 896.1 kB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e22f32d981a1e956178cbc2b9ab5e7c74dd1189ab9081a97b88e988c98818692
BLAKE2b-256 checksum
How to use checksums
226a101dcbdaaa2c554456101b89ca4cecf426c09afadaed51aa93013cdc7e98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / vfb-0.2.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.musllinux_1_1_i686.whl

Download URL vfb-0.2.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.musllinux_1_1_i686.whl
Size 854.3 kB
Tags Linux glibc 2.17+ x86-32 Linux musl 1.1+ x86-32 Python 3
SHA-256 checksum
How to use checksums
b6b78fadfa8f95dafc3168fe15a04aa418e4e3a1023a3f3565f634b4f1d70ef1
BLAKE2b-256 checksum
How to use checksums
c9e6508bb60e2c48a4a97c70e27df12987b1c404364d6c7ce4bcb2bd7994bc15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / vfb-0.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl

Download URL vfb-0.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
Size 818.8 kB
Tags Linux glibc 2.17+ ARM64 Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
d068a28f821033d827a7728bcb98ac0c708cb7d1abd0949b8108dc6e8602620c
BLAKE2b-256 checksum
How to use checksums
8330ff3203be2a0cc673fdb1f929be79478e8a040f0ed714bdf296bc3e8f8112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / vfb-0.2.1-py3-none-macosx_12_0_universal2.whl

Download URL vfb-0.2.1-py3-none-macosx_12_0_universal2.whl
Size 40.0 kB
Tags Python 3 macOS 12.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
d834bbc24f6727267ea0374f5d5cd3a247841cc034f5735c31b132453635fe2f
BLAKE2b-256 checksum
How to use checksums
1d5fa3f77ff51961f74c7a6acdfaaeb406477f1c8ecc52cdb582f30cc5048ca6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for vfb 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for vfb-0.2.1-py3-none-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page