Building from a Git checkout may require extra dependencies compared to building from a source tarball. Tip versions may also require different versions of Zig or other toolchains.
Prerequisites
All Platforms
- Zig - Ghostty requires a specific version of Zig (check
build.zig.zonfor the minimum version) - Git - To clone the repository
Platform-Specific Requirements
- macOS
- Linux
Required:
- Xcode 26 and macOS 26 SDK
- iOS SDK
- Metal Toolchain
Building Ghostty
Build the project
- Debug Build (Default)
- Release Build
Build a debug version for development:Debug builds include more logging and make diagnosing issues easier. This is the default and does not require any
-Doptimize flags.Common Build Commands
| Command | Description |
|---|---|
zig build | Builds Ghostty (debug mode by default) |
zig build run | Builds and runs Ghostty |
zig build test | Runs unit tests |
zig build test -Dtest-filter=<filter> | Runs tests matching the filter |
zig build run-valgrind | Runs Ghostty under Valgrind (memory leak checking) |
zig build update-translations | Updates translation strings |
zig build dist | Builds a source tarball |
zig build distcheck | Builds and validates a source tarball |
zig build lib-vt | Builds libghostty-vt |
Building libghostty-vt
Ghostty provideslibghostty-vt, a C-compatible library for parsing terminal sequences:
Development Tips
Running Tests
Run all tests:Checking for Memory Leaks
On Linux, use Valgrind to check for memory leaks:zig build run.
Code Formatting
Zig code:nix/devShell.nix.
Nix files (if applicable):
Logging
Ghostty’s logging behavior depends on optimization level and environment variables:- Debug builds output debug logs to
stderr - Release builds do not output debug logs to
stderr
GHOSTTY_LOG:
Nix Support
Ghostty provides Nix flake support for NixOS and Nix users:Development Shell
Build with Nix
Testing VMs
Run test VMs for different desktop environments:nix/vm directory.
Troubleshooting Build Issues
Xcode version or SDK not found (macOS)
Xcode version or SDK not found (macOS)
Ensure Xcode 26 is installed and selected:Verify the SDK is available:
blueprint-compiler not found (Linux)
blueprint-compiler not found (Linux)
Install blueprint-compiler version 0.16.0 or newer:
Zig version mismatch
Zig version mismatch
Check the required Zig version in Download the correct version from ziglang.org.
build.zig.zon and ensure your installed version meets the minimum requirement:Build fails with 'out of memory' error
Build fails with 'out of memory' error
Zig can be memory-intensive during compilation. Try:
- Close other applications
- Build with release optimizations:
zig build -Doptimize=ReleaseFast - Increase system swap space
Next Steps
- Read the Contributing Guide to learn about the contribution process
- Check Troubleshooting for runtime issues
- See HACKING.md for detailed development information