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 installed, 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, install the Virtual Display Driver once, as administrator; ci/install-vdd.ps1 does it on a machine nobody configured by hand.
Usage
vfb [:N] [-displayfd FD] [-screen 0 WxH[xD]] [-refresh HZ]
[-report geometry] [-eofexit] [-noparentwatch]
macOS only: [-scale 1|2] [-gamut p3|srgb] [-name NAME]
Windows only: [-match ID]
vfb list [-match ID] (Windows)
vfb detach N (Windows)
-displayfd FDwrites 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 only1(stdout) is supported, since a child inherits no other descriptor.-report geometrymakes the lineN 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.-eofexitstops 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
-noparentwatchis given. - Common Xvfb flags (
-ac,-nolisten tcp,-nocursor,-br,-extension X,+extension X,-fp X,-dpi X) are accepted and ignored.
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), and P3 primaries unless -gamut srgb is given.
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 detaches it on exit. A mode has to be listed in the driver's resolutions first; vfb names the available ones when it is not. vfb list shows the pool. 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. A tag vX.Y.Z also publishes them to PyPI and npm through trusted publishing.
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 ci/install-vdd.ps1 installs the driver first.
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.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 4.2 MB
Release files / vfb-0.1.0-py3-none-win_amd64.whl
| Download URL | vfb-0.1.0-py3-none-win_amd64.whl |
|---|---|
| Size | 856.1 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
916510b595e5b95697032e12b06c066ba1ecf74cf4e4393ccdeec1bbbed4b822
|
|
BLAKE2b-256 checksum How to use checksums |
e24ffeb86e9fcefcd6f973e717591d657e36cf87774e78d20f51317915eac571
|
| 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 logRelease files / vfb-0.1.0-py3-none-win32.whl
| Download URL | vfb-0.1.0-py3-none-win32.whl |
|---|---|
| Size | 828.8 kB |
| Tags | Python 3 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
8fd0cd1158e44560c3155b6d887fbd3b2b16ab7ca41ad6383142fb8af1af86ee
|
|
BLAKE2b-256 checksum How to use checksums |
39cdf0c9352a942fe2e13e42837e292c1d3722f34c143eb4da9baeb7c8819a11
|
| 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 logRelease files / vfb-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl
| Download URL | vfb-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl |
|---|---|
| Size | 871.7 kB |
| Tags | Linux glibc 2.17+ x86-64 Linux musl 1.1+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
cbedc846837631c3e044f99a65bf68936e0cf06fffeb3211e55433a844efc196
|
|
BLAKE2b-256 checksum How to use checksums |
08bd4a18e7faf3ff61a9209faf0cd223f10da6f7d9e910f790ed5b0fffbd92fc
|
| 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 logRelease files / vfb-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.musllinux_1_1_i686.whl
| Download URL | vfb-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.musllinux_1_1_i686.whl |
|---|---|
| Size | 827.7 kB |
| Tags | Linux glibc 2.17+ x86-32 Linux musl 1.1+ x86-32 Python 3 |
|
SHA-256 checksum How to use checksums |
b87b6bcbefe464b4588f0a3174054638d3ec6260974f21d066c2f66de10b3fa5
|
|
BLAKE2b-256 checksum How to use checksums |
21f564640755d22b0098511d2fa7b8ec320ee16d8f2642b701ed7a9c3f0eddf6
|
| 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 logRelease files / vfb-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
| Download URL | vfb-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl |
|---|---|
| Size | 795.1 kB |
| Tags | Linux glibc 2.17+ ARM64 Linux musl 1.1+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
187831c08bd71c26870ed2e2e247941a86bfc854ffdf6582a4a6d583447d9766
|
|
BLAKE2b-256 checksum How to use checksums |
8574cc20b44666374650ced634009eb36d2c74a8a9f5c02eea80a3f667a2da71
|
| 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 logRelease files / vfb-0.1.0-py3-none-macosx_12_0_universal2.whl
| Download URL | vfb-0.1.0-py3-none-macosx_12_0_universal2.whl |
|---|---|
| Size | 26.1 kB |
| Tags | Python 3 macOS 12.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
cc314df5412ff4083e88fd7abd1d960c22a54da8a6e389a38299ea1a83091138
|
|
BLAKE2b-256 checksum How to use checksums |
071ffebadfd8b00c3cb74fcd991b2d3a282cca0e328ab564ee0507a7bbb770f1
|
| 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 logSecurity for vfb 0.1.0
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.
Attestation for vfb-0.1.0-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 logA 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.