SiteBox

What Is Libghostty 1.0? Ghostty's Terminal Engine as a Stable C Library

Independent guide, not affiliated with Libghostty 1.0

Compiled by SiteBox / pinsily from the sources below. API and binding support are described from those sources; SiteBox has not independently built and tested each integration. Check the upstream documentation for your target version.

Published · Updated

What libghostty-vt is

libghostty-vt is a portable, high-performance C library for terminal emulation, extracted directly from the core of the Ghostty terminal emulator by its creator, Mitchell Hashimoto. The 1.0 release, announced on November 6, 2026, is the point where both the library itself and its C ABI become stable. Before 1.0 the API signatures were explicitly in flux; from 1.0 onward they are covered by an enforced stability policy.

The library is intentionally generic. You feed it the raw bytes a program writes - escape sequences, control characters, and text - and it parses them and maintains the full state of a terminal: the screen, the cursor position, scrollback, line wrapping, selection, and search. It can also encode input events such as key presses and mouse actions back into the byte sequences a running program expects.

It is built to be highly portable, high-performance, and nearly dependency-free. At runtime it needs nothing beyond libc, and it can even be compiled fully freestanding so it runs directly on hardware. It is tested on Linux, macOS, iOS, Android, FreeBSD, Windows, WebAssembly, and bare-metal RISC-V and ARM, on both 32-bit and 64-bit systems.

Why the 1.0 release matters: a stable C ABI

The headline of Libghostty 1.0 is ABI stability. libghostty-vt now follows semantic versioning with strict compatibility promises, so Linux and BSD distributions can package it confidently and application developers can dynamically link against it without fear of a silent break. Every object is an opaque handle, and the hundreds of values you read or write go through a small set of enum-keyed getters and setters, so the team can add new values without introducing new symbols.

The design deliberately trades a fixed struct layout for future-proofing. A program compiled with newer headers but linked against an older library returns GHOSTTY_UNSUPPORTED results instead of crashing or behaving unpredictably. The few non-opaque structs carry their own size so fields can be appended later. Enums are pinned to int, and on ELF platforms every exported symbol is versioned so the dynamic loader refuses to load a mismatched library by name.

Stability is enforced by CI rather than promised by hand. Every change is checked with libabigail against a committed baseline on Linux and against golden type manifests on macOS and WebAssembly. libghostty-vt also has its own release cycle, separate from the Ghostty application, with signed source tarballs and a companion dependencies tarball so a distribution can build the library completely offline.

What you can build with libghostty-vt

Because it handles all the hard terminal logic, libghostty-vt is the foundation for a wide range of tools: terminal emulators and multiplexers, web terminals and remote sessions, session recording and playback, test harnesses for TUI applications, and agents or automation that read what a text-based interface is showing. The maintainers describe one consumer that ran 10,000 active terminals, each with a running shell, on a single 4-core, 8 GB Linux machine.

Hashimoto's framing of the milestone is blunt: you can now create a terminal in roughly 1,500 lines of C that has more features and better performance than almost any terminal that existed in 2025. The library is already in production at scale - the project lists JetBrains, Neovim, KDE, and Vercel among its users, and estimates that libghostty-vt is used by tens of millions of people daily across desktop and mobile platforms.

How to install and build the library

There are several official ways to get libghostty-vt. The most direct is the signed source tarball: download libghostty-vt-1.0.0.tar.gz from release.files.ghostty.org, unpack it, and run zig build -Doptimize=ReleaseFast --prefix "$HOME/.local". This installs the shared and static libraries, the headers, and the pkg-config and CMake files. Building requires Zig 0.17, but you do not need to know any Zig to use it.

For other toolchains, CMake can fetch and build the library automatically, Zig projects can add it as a dependency, and Apple developers can drop in the prebuilt XCFramework as a Swift Package Manager binary target. For the web or JavaScript there are prebuilt WebAssembly modules, and Nix users can use the official flake. Note that prebuilt packages are not published for Linux, FreeBSD, or Windows - on those systems you build from source or use your distribution's package.

Once installed, C programs link against it with pkg-config: cc -o hello hello.c $(pkg-config --cflags --libs libghostty-vt). The header you include is <ghostty/vt.h>.

A minimal C example

The official documentation shows a complete program in a few lines. You create a terminal with ghostty_terminal_new, write bytes with ghostty_terminal_vt_write, attach a formatter with ghostty_formatter_terminal_new, and read the screen back with ghostty_formatter_format_alloc. The example writes 'Hello, world!' with an escape sequence that makes 'world' bold and green, then prints the resulting plain text.

What is useful about the example is what it does not do: there is no GUI window and no real PTY. It demonstrates that the library is a pure headless engine - you decide where the bytes come from (a pty, a network connection, a recording) and where the rendered state goes (a window, an HTML canvas, a test assertion). The same core powers a full terminal emulator and a one-off script.

Language bindings: Rust, Go, JavaScript, Python

Rust. The libghostty-vt crate on crates.io provides idiomatic, safe Rust bindings over the generated libghostty-vt-sys FFI layer. The central type is Terminal, and the ghostling-rs project is a minimal but functional terminal emulator built with it. The bindings are still pre-1.0, and the types are deliberately !Send and !Sync because the underlying C API is not thread-safe.

Go. mitchellh/go-libghostty, imported as go.mitchellh.com/libghostty, is the official Go binding. It uses cgo but defaults to static linking because libghostty-vt only depends on libc, which also makes cross-compilation straightforward with zig cc as the C compiler. As with the other bindings, the Go API is new and not yet guaranteed stable.

JavaScript. For JS there is no separate npm wrapper yet; the official path is the prebuilt WebAssembly module. Each release publishes ghostty-vt-VERSION.wasm (optimized for speed) and ghostty-vt-VERSION-small.wasm (optimized for size), which you download and load in the browser or in Node.

Python. python-libghostty-vt, imported as ghostty_vt, is a fully typed, two-layer binding: a private cffi layer over the C API plus a hand-written Pythonic layer organized into terminal, key, mouse, and related modules. It targets Python 3.14 and is still in early development. Beyond these four, the library is natively consumable from Zig, and Swift projects use the XCFramework.

Frequently asked questions

What is libghostty-vt?

libghostty-vt is a portable, high-performance C library for terminal emulation, extracted from the core of the Ghostty terminal emulator. You feed it the bytes a program writes and it parses them and exposes the terminal state - screen, cursor, scrollback, and more. The 1.0 release means its C ABI is now stable.

Is libghostty-vt free to use?

Yes. libghostty-vt is MIT licensed and open source, with no copyleft code anywhere in its dependency tree. At runtime it needs nothing beyond libc. Its few permissively licensed dependencies (simdutf, Highway, a Unicode table, and Wuffs) are listed in a machine-readable manifest with versions and hashes.

Is the C ABI actually stable now?

Yes, from 1.0. libghostty-vt follows semantic versioning and enforces ABI compatibility in CI using libabigail on Linux and golden type manifests on macOS and WebAssembly. On ELF platforms every exported symbol is versioned, so a mismatched library is refused by name rather than failing later.

Do I need to know Zig to use libghostty-vt?

No. Building the library requires Zig 0.17, but you never write Zig code. You can build via the source tarball, let CMake fetch and build it, use the Swift XCFramework, or download the prebuilt WebAssembly module - then link with pkg-config or your language's package manager.

Which language bindings are available?

Rust (the libghostty-vt crate), Go (mitchellh/go-libghostty), Python (python-libghostty-vt), and JavaScript (the prebuilt WebAssembly module). The library is also natively usable from Zig, and Apple platforms get a Swift XCFramework. All bindings except the core C library are still pre-1.0.

Sources