A four-hour Claude Code session built a Mac bridge for HP's Laser 1008a

Kuber Mehta (@kuberwastaken) used Anthropic's Claude Code to make an HP Laser 1008a print from an Apple Silicon Mac, completing the first working version during a roughly four-hour session on August 17th.

The resulting MIT-licensed repository turns printing into an ordinary Cmd-P workflow for HP's Laser 1003, 1006 and 1008 models. The plumbing underneath is considerably less ordinary: a CUPS queue, a root daemon, an always-on Linux virtual machine, HP's proprietary raster encoder and direct USB writes.

Mehta documented the work in a lightly redacted session transcript. According to his resume, he is studying computer science and artificial intelligence at BITS Pilani and Guru Gobind Singh Indraprastha University, works on central AI initiatives at Razorpay, and founded generative-interface project PolyThink Labs. The printer project began as a request to install a driver on a family Mac, rather than a planned software release.

Four hours across the printing stack

Mehta says he ran the session with Claude Opus 4.8, the model Anthropic released on May 28th for coding and long-running agent work. Claude Code initially followed the obvious path: detect the USB device, inspect the available CUPS drivers and install a generic PCL configuration.

That configuration stalled because the Laser 1008a uses Samsung Printer Language, or SPL, instead of PCL or PostScript. The printer is based on Samsung hardware and requires the host computer to generate a device-specific raster stream.

The session then moved through several failed approaches. Generic drivers left the device offline. The open-source foo2zjs encoder prompted the printer to produce an error page asking for the proper driver. Mehta also tested SpliX 2.0.2, which recently added support for related HP Laser models, but its output produced striped, repeated pages on his 1008a.

The working path reused HP's rastertospl binary from its Unified Linux Driver. Because that binary cannot run directly on macOS, the installer places it inside an ARM64 Linux container managed by Colima. A macOS CUPS queue converts application output into CUPS raster data and sends it to a local socket. A root LaunchDaemon receives the job, passes it through HP's codec and uses libusb to write the resulting SPL3 stream directly to the printer.

That split also bypasses two macOS restrictions Mehta encountered: CUPS filters cannot invoke the container from their sandbox, and the standard USB backend treated the printer as permanently offline. Moving both operations into a daemon outside the CUPS sandbox produced a clean test page.

HP's macOS support records disagree with its driver page

HP's documentation makes the compatibility problem harder to parse. The Laser 1008a specifications page lists versions of macOS through Sonoma among compatible operating systems. Yet HP's current driver-download page offers Linux and several Windows versions in its operating-system selector, with no macOS option.

HP's 2023 product data sheet also mentions AirPrint, though its footnotes restrict wireless and mobile printing to the 1008w. The 1008a has only USB connectivity. Mehta's tests found no driverless IPP endpoint on that USB connection, leaving macOS 26 without a usable built-in path on his machine.

The repository has so far been tested on Apple Silicon Macs running macOS 26, according to Mehta. It supports the USB-only "a" models and "w" models connected by USB. Broader compatibility has not been established.

Native printing, with an always-on Linux VM

The result behaves like a native printer from an application. The implementation stretches the term "native" considerably.

Installation requires Homebrew and adds Colima, Docker and libusb, along with a small Linux VM that must remain available. It also installs a root LaunchDaemon and a login item to restart Colima after reboot. The installer requests the Mac administrator password and downloads HP's Linux driver during setup.

The repository contains Mehta's glue code rather than HP's codec. The installer fetches the proprietary rastertospl binary from HP, while Mehta's components are published under the MIT license.

A first print after reboot can wait for up to a minute while the VM starts. Jobs sent after the printer has powered down take around 10 to 15 seconds as the printer wakes and heats its fuser, according to Mehta. Conversion and USB delivery take about one second once the system is running.

Those dependencies make the project a practical fix for owners who already have the hardware, rather than a lightweight universal printer package. A cleaner version would require identifying the byte-level differences between HP's SPL3 output and the malformed output generated by SpliX. Mehta is asking contributors to help patch that open-source encoder, which could remove the Linux VM from the path.

The session is a useful measure of where coding agents have become effective: obscure problems that cross shell commands, operating-system services, binary codecs, container runtimes and physical hardware. Claude Code traversed those layers in one sitting and generated a packaged installer. Mehta still supplied the device, interpreted its physical output and tested every attempted fix. The shipped artifact came from that loop between an agent operating the Mac and a developer standing beside the printer.

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论