The Ghostty terminal emulator has finished a rewrite1 of its GTK version. Lead developer Mitchell Hashimoto says the effort will provide a “more feature rich, stable, and maintainable Ghostty on Linux and BSD” going forward.

As a refresher, Ghostty is an open-source, cross-platform terminal emulator build to scratch its creator’s itch for a fast and feature-rich tool with GPU acceleration. It debuted late last year and has since picked up a large following.

Ghostty takes a different approach to cross-platform development: it’s native where it runs

The backend core is built in Zig (yes, something that isn’t Rust – shocking for 2025), but it takes a different tack to cross-platform development: native and integrated with each platform it runs on.

On macOS, Ghostty uses Swift. On Linux, it uses GTK4 with Wayland and X11 support.

Both frontends share the same core terminal engine backend, written in Zig which exports a C ABI compatible API.

However, the “legacy” GTK implementation had memory issues.

Hashimoto says there was “an entire class of bug that kept popping up in the Ghostty GTK application that could basically be summed up as: the Zig memory or the GTK memory has been freed, but not both.”

It was time to exorcise a few implementation demons.

Ghostty now works with GTK, not against it

An older version of Ghostty running on Ubuntu 24.04 LTS

Ghostty’s GTK revamp is fully embracing GTK’s reference-counting object system to handle memory management, rather than, as before, opting to avoid it to handle things manually.

“Whatever your feelings are about OOP and memory management, the reality is that if you choose GTK, you’re forced into interfacing in some way with the GObject type system,” he explains.

“You can’t avoid it.”

Embracing GObject will allow Ghostty to make use of more “GTK-native features such as signals (events), properties (which can be bound to by GUI elements), actions (invoking one-way behavior from afar)”, and so on.

This improves the end-user experience with literal extra bells — e.g., ding – command complete! — that were difficult to add before, and in making use of modern GTK technologies they simplify the maintenance burden going forward.

Valgrind, the debugging tool, has been used throughout the rewrite to find and fix memory issues before they could become issues. Hashimoto states with confidence that the new version is “fully clean of memory leaks and undefined access”.

More details on the technical how’s and why’s can be gleaned from Hashimoto’s blog post.

Getting the Ghostty GTK Rewrite

The first ‘rewrite’ GTK builds of Ghostty for Linux will be released in Ghostty 1.2, which is due for release in a few weeks. It is already default if you choose to build from source, so… Perhaps a weekend project for any table-rappers seeking contact with the other side?

If you already use Ghostty on Ubuntu (or other Linux distributions) and you have experienced crashes or other odd behaviours whilst using it, you will see improvements in stability in the new version.

And if you’ve not tried Ghostty but fancy doing so, it might be worth holding off for a bit. The upcoming release will give you the best possible first impression — not a jump scare if it crashes in the middle of an important command!

  1. In his blog post, Hashimoto refers to the change as a ‘rewrite’. In the pull request he states it is “a refactor, not a rewrite”. I’ve rolled with rewrite for simplicities sake as to most non-technical users the difference is the same: code was changed, and now it’s better. ↩︎