Skip to main content
This guide explains how to build Ghostty from source. Building from source is useful for contributing to development, testing new features, or creating custom builds.
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.zon for the minimum version)
  • Git - To clone the repository

Platform-Specific Requirements

Required:
  • Xcode 26 and macOS 26 SDK
  • iOS SDK
  • Metal Toolchain
Main branch development requires Xcode 26 and the macOS 26 SDK. You do not need to be running macOS 26 to build Ghostty - you can use Xcode 26 on macOS 15 stable.
Ensure the correct version of Xcode is selected:

Building Ghostty

1

Clone the repository

2

Build the project

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.
3

Run Ghostty

You can pass additional arguments after --:

Common Build Commands

Building libghostty-vt

Ghostty provides libghostty-vt, a C-compatible library for parsing terminal sequences:
This library is available for Zig and C and compatible with macOS, Linux, Windows, and WebAssembly.

Development Tips

Running Tests

Run all tests:
Run specific tests:
Run libghostty-vt tests:

Checking for Memory Leaks

On Linux, use Valgrind to check for memory leaks:
This builds Ghostty with Valgrind support and runs it with proper flags to suppress known false positives. You can pass the same arguments as zig build run.

Code Formatting

Zig code:
Other files (Markdown, JSON, etc.):
Make sure your Prettier version matches the version in 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
Control logging destinations with GHOSTTY_LOG:
View logs on macOS:
View logs on Linux (systemd):

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:
Available VMs are defined in the nix/vm directory.

Troubleshooting Build Issues

Ensure Xcode 26 is installed and selected:
Verify the SDK is available:
Install blueprint-compiler version 0.16.0 or newer:
Check the required Zig version in build.zig.zon and ensure your installed version meets the minimum requirement:
Download the correct version from ziglang.org.
Zig can be memory-intensive during compilation. Try:
  1. Close other applications
  2. Build with release optimizations: zig build -Doptimize=ReleaseFast
  3. Increase system swap space

Next Steps