GhosttyKit
May 19, 2026 ยท View on GitHub
Swift Package Manager wrapper around the upstream libghostty macOS XCFramework.
GhosttyKit publishes a normal Swift package product that client apps can
import directly. The repo tracks a checked-in framework-style
GhosttyKit.xcframework that SwiftPM consumes from the package checkout, plus
a zipped copy for release packaging. The vendored binary and header mirror come from
ghostty-org/ghostty.
Install
After the initial tag is published:
.package(url: "https://github.com/briannadoubt/GhosttyKit.git", from: "0.1.3")
Then depend on the GhosttyKit product from your target.
This package currently ships a macOS arm64 binary built with a minimum deployment target of macOS 13.
Default AppKit host
For SwiftUI, drop in the ready-made view:
import GhosttyKit
GhosttyTerminal()
For AppKit, ask a session for its hosted view:
import GhosttyKit
let terminalView = GhosttyTerminalSession().makeView()
To try the bundled demo app:
swift run GhosttyKitDemo
GhosttyTerminalView installs the AppKit responder/text-input behavior that a
terminal needs by default, including Delete/Return/arrow key handling without
system beeps, copy/paste responder actions, mouse tracking, focus updates,
backing-scale updates, link context-menu actions, cursor shape updates, config
open/reload actions, title and working-directory state, search/progress/process
state, secure-input bridging, size hints, tab/split request callbacks, desktop
notification callbacks, config diagnostics, and standard pasteboard callbacks.
The default host also loads the user's Ghostty config and, when no theme is
configured, writes a small managed light/dark theme override so embedded
terminals do not render as plain unstyled text.
Downstream packages resolve the checked-in Vendor/GhosttyKit.xcframework
through a local SwiftPM binary target, so the package stays consumable without
unsafe build flags or remote artifact indirection.
Updating libghostty
The vendored artifact and headers are refreshed from the upstream Ghostty source
tracked in the Vendor/ghostty-upstream submodule.
For a manual refresh:
git submodule update --init --recursive
./Scripts/update-libghostty.sh
To pin a specific upstream ref first:
./Scripts/update-libghostty.sh --ref origin/main
./Scripts/update-libghostty.sh --latest-tag
The script rebuilds GhosttyKit.xcframework, syncs the public headers, refreshes
the local static library mirror, and records the exact upstream commit in
Vendor/libghostty.version.
To refresh the tracked distribution archive without rebuilding:
./Scripts/unpack-artifact.sh
./Scripts/package-artifact.sh
Automation
- CI validates the package builds and tests cleanly on macOS arm64 and checks that the repo is publishable without SwiftPM unsafe flags.
- Dependabot checks both GitHub Actions and the
Vendor/ghostty-upstreamsubmodule nightly. - A GitHub Actions workflow amends Dependabot submodule PRs by regenerating the
zipped XCFramework, header mirror, and metadata so upstream
libghosttychanges arrive as a reviewable pull request instead of manual repo surgery.
License
This wrapper is MIT licensed. The bundled libghostty sources and binary are
derived from upstream Ghostty, which is also MIT licensed.