GTK OpenGL Context Errors
In some situations, Ghostty may fail to start with an error about being "unable to acquire an OpenGL context". This page adds more details about this error and how to resolve it.
The Ghostty GTK application uses OpenGL for rendering. To render with OpenGL, Ghostty needs to first acquire an "OpenGL context" from GTK. This gives us the namespace to execute OpenGL commands.
In rare situations, GTK may be unable to provide Ghostty with an OpenGL context. When this happens, Ghostty is unable to render anything and must show this error.
This is always an environment issue. GTK provides Ghostty with the OpenGL context, and there isn't generaly anything Ghostty itself can do to resolve this directly. It is usually an issue regarding a library, driver, or OS package version. This page will attempt to provide some assistance in tracking down the issue.
If you want to try to get Ghostty working quickly, try the following.
-
Install a binary package. If you're building from source, try using a binary package instead. Binary packages tend to be built in a more controlled environment that works with a specific distribution and its libraries.
-
Check your GPU drivers. GPU drivers are a common cause of OpenGL issues. Try updating or downgrading your GPU drivers, especially if you're using proprietary drivers.
-
Build Ghostty from source using only system packages. If you're using the Nix development environment to build Ghostty, try building it from source using only system packages. See the build from source instructions to do this (but ignore the "Building with Nix" section).
Important
This section purposely avoids any detail in understanding the root cause of this issue. If you want to better understand the root cause, please read below this section.
A common cause of this error is mismatched library versions. The balance between GTK, Mesa, libX11/libwayland, and the kernel is a fragile one.
The first most common cause of this error is using the Nix development environment to build Ghostty. We recommend this environment for development, but it does pin various versions of these libraries and they may be incompatible with your global system. To fix: try to build Ghostty using only system dependency packages, or Ghostty itself from a system package. You can follow the build from source instructions to do this (but ignore the "Building with Nix" section)
Another common cause is outdated system packages. Linux distributions tend to handle this fragile balance for you, so the try to update your entire system (or, specifically the packages above, at least). This often brings your system back into a coherent state that allows Ghostty to work.
Check your GPU drivers. Try updating or downgrading your GPU drivers. We've had many cases where GPU driver changes have broken OpenGL in GTK.
-
Mesa 25.2.0 Regression. Ghostty doesn't bundle a libwayland clent library, but building Ghostty from source with the Nix development environment will use a different libwayland client library than the system one.
-
GTK4 + Nvidia + X11. I don't know the exact combination required to trigger this, but it seems in certain scenarios, the mixture of GTK4 (required by Ghostty), Nvidia, and X11 can cause this issue. Changing driver versions or changing to Wayland can resolve this.