# CUPS on Linux and macOS

CUPS speaks to network printers through a `socket://` URI, which is exactly what a virtual printer
listens for.

## Adding the queue

```bash
lpadmin -p virtual-receipt \
        -v socket://virtual-printer.online:9411 \
        -E \
        -m raw
```

Substitute your own port. `-m raw` is the important part: it creates a queue with no driver, so the
bytes you send arrive unchanged. `-E` enables the queue immediately.

Print to it the way you print to anything else:

```bash
lp -d virtual-receipt receipt.bin
```

For a driver-based queue - when what you want to test is the driver's output rather than your own
bytes - replace `-m raw` with the PPD your vendor supplies.

## macOS

The same commands work; CUPS is the printing system there too. The graphical *Add Printer* dialog can
also do it: hold Option to reveal *Advanced*, choose type **AppSocket/HP JetDirect**, and enter
`socket://virtual-printer.online:9411`.

## Checking the queue

```bash
lpstat -p virtual-receipt   # queue state
lpstat -o                   # jobs waiting
```

A job that sits in the queue rather than completing usually means the connection is being reset - check
[Workspace Settings -> Access Log](/#settings/connections), because the
[IP whitelist](/#settings/whitelist) is the most likely reason.
