![]() |
libghostty-vt 0.0.0
|
libghostty-vt is a normal C library. There are several official ways to get it:
We don't publish prebuilt packages for Linux, FreeBSD or Windows. On those systems, you build from source or use your system's package if it has one.
Every method that builds the library needs Zig 0.17. You don't need to know any Zig to do it. The build stops with an error on any other minor version. Different libghostty-vt versions may require different Zig versions, the Zig version is not part of our ABI promise.
libghostty-vt is released separately from Ghostty, with its own version numbers and its own vt-X.Y.Z tags. Each release is published to one directory:
VERSION is the version number with no prefix, such as 0.1.0. The directory has the following files:
| File | Contents |
|---|---|
| libghostty-vt-VERSION.tar.gz | Source tarball |
| libghostty-vt-VERSION-deps.tar.gz | Zig packages for building with no network |
| libghostty-vt-VERSION-docs.zip | This documentation as HTML |
| ghostty-vt-VERSION.xcframework.zip | Static libraries for macOS and iOS |
| ghostty-vt-VERSION.wasm | WebAssembly module, optimized for speed |
| ghostty-vt-VERSION-small.wasm | WebAssembly module, optimized for size |
| SHA256SUMS | Checksums of all of the above |
Verifying a download: every file has a minisign signature next to it, with a .minisig extension. Check SHA256SUMS against our public key, then check your files against SHA256SUMS:
Trying unreleased code: the tip release has a source tarball, an XCFramework and the WebAssembly modules built from the latest commit to main. They change with every commit, so don't ship them.
The XCFramework has static libraries for macOS (arm64 and x86_64), iOS, and the iOS simulator, along with the headers and a module map. Add it to your package as a binaryTarget:
The checksum is the line for the zip in SHA256SUMS. Depend on GhosttyVt from your target, then import GhosttyVt to call the C API from Swift. In an Xcode project, unzip it and add ghostty-vt.xcframework to your target instead.
To build it yourself, run this from a checkout on a Mac with Xcode to get zig-out/lib/ghostty-vt.xcframework:
See swift-vt-xcframework for a full example.
We publish two builds of the WebAssembly module, and both have every feature enabled:
To build it yourself, for example to leave out features and make it smaller, run this from a checkout to get zig-out/bin/ghostty-vt.wasm:
See wasm-vt for how to load it from JavaScript, and WebAssembly for the functions that only exist for this build.
CMake can fetch and build the library for you, so you can skip the build below. You still need zig on your PATH.
The hash is the line for the tarball in SHA256SUMS. Link ghostty-vt-static instead for the static library.
If you already installed the library, use find_package(ghostty-vt REQUIRED) and link ghostty-vt::ghostty-vt. Pass -DCMAKE_PREFIX_PATH="$HOME/.local" if CMake can't find it.
See c-vt-cmake and c-vt-cmake-static. To cross-compile, see c-vt-cmake-cross and the CMake README.
Zig programs can use the Zig module directly, which skips the C API:
Then import the module in your build.zig:
See zig-vt. If your Zig build compiles a C program, use exe_mod.linkLibrary(dep.artifact("ghostty-vt")) instead, as c-vt-stream does.
Our flake has a libghostty-vt package, built with ReleaseFast:
The ^* builds every output. The default output has the shared library, and the dev output has the headers, the static library, and the pkg-config and CMake files.
Download a source tarball and build it:
This installs the shared library, the static library, the headers, and the pkg-config and CMake files.
Use the release tarball, not the archive GitHub generates for a tag. The GitHub archive is missing the file that tells the build to make the library, so it builds the Ghostty app instead.
From a checkout: to build main or any other commit, add -Demit-lib-vt. Without it, zig build builds the Ghostty app.
With no network: the build downloads a few Zig packages. The dependency tarball has all of them, and the packaging guide shows how to use it. If you're packaging libghostty-vt for a distribution, start there.
Save the program from the main page as hello.c and build it:
The rpath tells the loader where the shared library is. On macOS you always need one, because the library loads as @rpath/libghostty-vt.0.dylib. On Linux you can drop it if you install to a directory the loader already searches, such as /usr/lib.
Link statically when you want one binary with nothing to install next to it:
Most programs don't need any of these. The packaging guide has the whole list.
-Dsimd=false removes the SIMD code. On Linux that also removes libc: the shared library then links nothing at all. It makes parsing much slower, so only do this if libc is what you're trying to avoid. WebAssembly and freestanding builds are like this already. On macOS the library still links libSystem, like every program does.
-Dvt-features leaves out parts of the library to make it smaller. See Optional Features.