Ghostty is tracked as a git submodule:
git submodule update --init --recursiveCurrent checked source:
Vendor/ghostty @ 0071971b5
Ghostty declares Zig 0.15.2 as the minimum required version in Vendor/ghostty/build.zig.zon.
For reproducible local builds without changing the system Zig install, download Zig into .tools/:
mkdir -p .tools
curl -L https://ziglang.org/download/0.15.2/zig-aarch64-macos-0.15.2.tar.xz -o .tools/zig-aarch64-macos-0.15.2.tar.xz
tar -xf .tools/zig-aarch64-macos-0.15.2.tar.xz -C .tools
.tools/zig-aarch64-macos-0.15.2/zig version.tools/ is intentionally ignored by git.
Vendor/ghostty.patch carries ProGhostty's small additions to the vendored
Ghostty source. The submodule is pinned to an upstream commit, so a clean
checkout never contains these changes — the patch must be applied after every
git submodule update and before building the VT library. CI applies it in both
ci.yml and release.yml.
git submodule update --init --recursive
cd Vendor/ghostty
git apply ../ghostty.patch
cd ../..The patch adds GHOSTTY_TERMINAL_DATA_CURSOR_SEMANTIC_CONTENT (and its
getTyped case) — the cursor semantic state ProGhostty's click-to-position
uses to distinguish a live input prompt from a stale/running command line.
Keep
.aand header in sync. The rebuiltlibghostty-vt.areferences the new enum value. The C shim and the.amust come from the same build; a rebuilt.awithout the applied patch (or vice-versa) is undefined behavior, since the enum value is read with no runtime bounds check under ReleaseFast.
Run from Vendor/ghostty:
-Doptimize=ReleaseFastis required. Without it the VT library builds in Zig's Debug mode (full runtime safety checks, no optimization), which makesghostty_terminal_vt_writethousands of times slower — a bulk burst likeseq 1 30000then stalls the UI for seconds.-Demit-xcframework=falseskips the xcodebuild-only packaging we don't link against (Package.swift uses the.adirectly).
../../.tools/zig-aarch64-macos-0.15.2/zig build \
--global-cache-dir ../../.zig-cache-global \
-Demit-lib-vt=true \
-Demit-xcframework=false \
-Doptimize=ReleaseFastWith Command Line Tools only, the static/dynamic VT library build succeeds and installs:
Vendor/ghostty/zig-out/lib/libghostty-vt.a
Vendor/ghostty/zig-out/lib/libghostty-vt.0.1.0.dylib
Vendor/ghostty/zig-out/include/ghostty/vt.h
Vendor/ghostty/zig-out/share/pkgconfig/libghostty-vt.pc
Vendor/ghostty/zig-out/share/pkgconfig/libghostty-vt-static.pc
The final ghostty-vt.xcframework packaging step currently fails on this machine because xcodebuild -create-xcframework requires full Xcode, while xcode-select points to Command Line Tools.
Short term:
- Install full Xcode.
- Run
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer. - Re-run the VT build command above and confirm
Vendor/ghostty/zig-out/lib/ghostty-vt.xcframeworkexists. - Add a SwiftPM binary target or local linker settings for the VT API.
Long term:
- Study
Vendor/ghostty/macosandGhosttyKit.xcframeworkgeneration. - Keep all full libghostty/GhosttyKit calls isolated in
GhosttyVTBridge. - Do not let UI/product code depend on Ghostty C/Zig APIs directly.