Skip to content

Commit aa2662b

Browse files
authored
Merge pull request #358 from pluiedev/pluie/jj-skqxktqmsvox
docs/install: revamp build instructions for 1.2
2 parents 754363e + 8827019 commit aa2662b

File tree

1 file changed

+155
-61
lines changed

1 file changed

+155
-61
lines changed

docs/install/build.mdx

Lines changed: 155 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,35 @@ description: |-
77
---
88

99
<Tip>
10+
1011
**Building Ghostty from source is not recommended for most users.**
1112
If you have access to a prebuilt binary or package, you should use that
1213
instead. See [the binaries and packages page](/docs/install/binary) to
1314
see if a prebuilt binary or package is available for your platform.
15+
1416
</Tip>
1517

16-
To build Ghostty, you need [Zig 0.14](https://ziglang.org/) installed.
18+
To build Ghostty, you need [Zig](https://ziglang.org/) installed.
1719

1820
<Important>
19-
**Zig 0.14 is required.** Ghostty only guarantees that it can build
20-
against 0.14. Zig is still a fast-moving project so it is likely newer
21-
versions will not be able to build Ghostty yet. You can find binary
22-
releases of Zig release builds on the
23-
[Zig downloads page](https://ziglang.org/download/).
21+
22+
Each version of Ghostty is only guaranteed to build for one **specific** version
23+
of Zig as it is still a rapidly-evolving project. **Either older or newer
24+
Zig compilers may not be able to build Ghostty.** If your package manager
25+
maintains a different version of Zig than what Ghostty requires, you can use
26+
static binary releases of the Zig compiler on the [Zig downloads page](https://ziglang.org/download/).
27+
2428
</Important>
2529

30+
The Zig version that each Ghostty version requires is as follows:
31+
32+
| Ghostty version | Zig version |
33+
|-----------------|-------------|
34+
| 1.0.x | 0.13.0 |
35+
| 1.1.x | 0.13.0 |
36+
| 1.2.x | 0.14.1 |
37+
| tip | 0.14.1 |
38+
2639
The official build environment is defined by [Nix](https://nixos.org/).
2740
You do not need to use Nix to build Ghostty, but the Nix environment is the
2841
environment which runs CI tests and builds release artifacts, so it is the most
@@ -33,24 +46,64 @@ Depending on your platform, you may also need to install additional
3346
dependencies to build Ghostty. For Linux, see [Linux](#linux). For macOS,
3447
see [macOS](#macos).
3548

36-
Begin by cloning the Ghostty repository and changing into the directory:
49+
## Getting the source code
3750

38-
```sh
39-
git clone https://github.com/ghostty-org/ghostty
40-
cd ghostty
51+
Begin by **downloading Ghostty's source tarball**.
52+
53+
<Warning>
54+
55+
While you can compile Ghostty from source by checking out its Git repository,
56+
this is **not recommended** for anyone but Ghostty developers and contributors.
57+
This is because source tarballs contain various preprocessed files that make
58+
Ghostty require far fewer dependencies to compile.
59+
60+
If you intend to contribute to Ghostty, please consult the
61+
[README](https://github.com/ghostty-org/ghostty/blob/main/README.md#developing-ghostty)
62+
file on the steps to build Ghostty in a development environment.
63+
While most of the steps are exactly the same, we will be assuming a source
64+
tarball-based build for now on for the sake of simplicity.
65+
66+
</Warning>
67+
68+
For stable releases, source tarballs and their accompanying checksums can be
69+
found at `releases.files.ghostty.org` at the following paths, where `VERSION`
70+
is an unprefixed version number such as `1.0.0`:
71+
72+
```
73+
https://release.files.ghostty.org/VERSION/ghostty-VERSION.tar.gz
74+
https://release.files.ghostty.org/VERSION/ghostty-VERSION.tar.gz.minisig
4175
```
4276

43-
To build a stable release, check out the associated tag. If you skip this
44-
step you'll build the [tip version](/docs/install/pre).
77+
Signature files are signed with
78+
[minisign](https://jedisct1.github.io/minisign/)
79+
using the following public key:
80+
```
81+
RWQlAjJC23149WL2sEpT/l0QKy7hMIFhYdQOFy0Z7z7PbneUgvlsnYcV
82+
```
83+
84+
For development ("tip") versions, the source tarball can be found via the
85+
[`tip` release on GitHub](https://github.com/ghostty-org/ghostty/releases/tag/tip),
86+
under the name `ghostty-source.tar.gz`.
4587

4688
<Important>
47-
**Version 1.1.3 and under requires Zig version 0.13 to build**. When building
48-
from tip you will however need Zig version 0.14 due to build system changes and
49-
other updates to the tooling used.
89+
90+
The source tarball is **different** from GitHub's autogenerated tarball
91+
labelled "Source code (zip)" or "Source code (tar.gz)": the latter of which does
92+
not contain any preprocessed files, making it identical to a Git checkout.
93+
5094
</Important>
5195

52-
```
53-
git checkout <tag>
96+
Decompress the release tarball, and then navigate into the unpacked source folder:
97+
98+
```sh
99+
tar -xf ghostty-VERSION.tar.gz
100+
cd ghostty-VERSION/
101+
102+
# Or when using a tip source tarball:
103+
# (REVISION is the commit SHA of the latest commit)
104+
105+
tar -xf ghostty-source.tar.gz
106+
cd ghostty-VERSION-main+REVISION/
54107
```
55108

56109
With Zig and necessary dependencies installed, a binary can then be built
@@ -64,14 +117,18 @@ On Linux, this will build a ready-to-use binary at `zig-out/bin/ghostty`.
64117
On macOS, this will build the app bundle at `zig-out/Ghostty.app`.
65118

66119
<Tip>
120+
67121
For Linux users: To install system-wide or on your user account, see
68122
[Installation Directory](#installation-directory).
123+
69124
</Tip>
70125

71126
<Tip>
127+
72128
For a debug build, omit the `-Doptimize=ReleaseFast` flag. Debug builds
73129
are **extremely slow** (over 100x slower) than release builds, so only
74130
use them for development.
131+
75132
</Tip>
76133

77134
## Linux
@@ -86,105 +143,143 @@ Required dependencies:
86143

87144
* `gtk4`
88145
* `libadwaita`
89-
* `blueprint-compiler`
90-
* `pkg-config`
146+
* `gtk4-layer-shell`
147+
* `pkg-config` or `pkgconf`
91148
* `gettext`
92149

93-
<Warning>
94-
GTK 4.14 on Wayland has a bug which may cause an immediate crash.
95-
There is an
96-
[open issue](https://gitlab.gnome.org/GNOME/gtk/-/issues/6589)
97-
to track this GTK bug. You can workaround this issue by running ghostty with
98-
`GDK_DEBUG=gl-disable-gles ghostty`.
99-
</Warning>
150+
<Important>
151+
152+
If you're using a Git checkout, you also need to install these dependnecies:
153+
154+
* `blueprint-compiler`
155+
156+
</Important>
157+
158+
<Tip>
159+
160+
If your distro has yet to package `gtk4-layer-shell` (e.g. Ubuntu 24.04, Debian
161+
12, Linux Mint 22.1, OpenSUSE, etc.), you need to allow Ghostty to compile
162+
`gtk4-layer-shell` from source by adding the flag `-fno-sys=gtk4-layer-shell`
163+
to `zig build`.
164+
165+
</Tip>
100166

101167
#### Alpine
102168

103169
```sh
104-
doas apk add gtk4.0-dev libadwaita-dev pkgconf ncurses blueprint-compiler gettext
170+
doas apk add \
171+
gtk4.0-dev \
172+
libadwaita-dev \
173+
pkgconf \
174+
ncurses \
175+
gettext
105176
```
106177

107178
#### Arch Linux
108179

109180
```sh
110-
sudo pacman -S gtk4 gtk4-layer-shell libadwaita blueprint-compiler gettext
181+
sudo pacman -S \
182+
gtk4 \
183+
gtk4-layer-shell \
184+
libadwaita \
185+
gettext
111186
```
112187

113188
#### Debian and Ubuntu
114189

115190
```sh
116-
sudo apt install libgtk-4-dev libadwaita-1-dev git blueprint-compiler gettext libxml2-utils
191+
sudo apt install \
192+
libgtk-4-dev \
193+
libgtk4-layer-shell-dev \
194+
libadwaita-1-dev \
195+
gettext \
196+
libxml2-utils
117197
```
118198

119199
On Debian unstable/testing, the `gcc-multilib` package is also required
120200
for building.
121201

122-
On Ubuntu 24.10+ and Debian trixie+, `libgtk4-layer-shell-dev` is also
123-
needed for building.
124-
125-
<Note>
126-
**A recent GTK is required for Ghostty to work with Nvidia (GL) drivers
127-
under x11.** Ubuntu 22.04 LTS has GTK 4.6 which is not new enough. Ubuntu 23.10
128-
has GTK 4.12 and works. From [this discussion](https://discourse.gnome.org/t/opengl-context-version-not-respected-on-gtk4-rs/12162?u=cdehais)
129-
the problem was fixed in GTK by Dec 2022. Also, if you are a BTRFS user, make
130-
sure to manually upgrade your Kernel (6.6.6 will work). The stock kernel in
131-
Ubuntu 23.10 is 6.5.0 which has a bug which
132-
[causes zig to fail its hash check for packages](https://github.com/ziglang/zig/issues/17282).
133-
</Note>
134-
135202
#### Fedora
136203

137204
On Fedora variants, use
138205

139206
```sh
140-
sudo dnf install gtk4-devel gtk4-layer-shell-devel zig libadwaita-devel blueprint-compiler gettext
207+
sudo dnf install \
208+
gtk4-devel \
209+
gtk4-layer-shell-devel \
210+
zig \
211+
libadwaita-devel \
212+
gettext
141213
```
142214

143215
On Fedora Atomic variants, use
144216

145217
```sh
146-
rpm-ostree install gtk4-devel gtk4-layer-shell-devel zig libadwaita-devel blueprint-compiler gettext
218+
rpm-ostree install \
219+
gtk4-devel \
220+
gtk4-layer-shell-devel \
221+
zig \
222+
libadwaita-devel \
223+
gettext
147224
```
148225

149226
#### Gentoo
150227

151228
```sh
152-
emerge -av libadwaita gtk blueprint-compiler gettext
229+
emerge -av \
230+
libadwaita \
231+
gtk \
232+
blueprint-compiler \
233+
gettext
153234
```
154235

155236
#### openSUSE Tumbleweed
156237

157238
```sh
158-
sudo zypper install gtk4-devel libadwaita-devel pkgconf ncurses-devel zig blueprint-compiler gettext
239+
sudo zypper install \
240+
gtk4-devel \
241+
libadwaita-devel \
242+
pkgconf \
243+
ncurses-devel \
244+
zig \
245+
gettext
159246
```
160247

161248
#### openSUSE Leap
162249

163250
```sh
164-
sudo zypper install gtk4-devel libadwaita-devel pkgconf ncurses-devel blueprint-compiler gettext
251+
sudo zypper install \
252+
gtk4-devel \
253+
libadwaita-devel \
254+
pkgconf \
255+
ncurses-devel \
256+
zig \
257+
gettext
165258
```
166259

167260
#### Solus
168261

169262
```sh
170-
sudo eopkg install libgtk-4-devel libadwaita-devel pkgconf zig blueprint-compiler gettext
263+
sudo eopkg install \
264+
libgtk-4-devel \
265+
libadwaita-devel \
266+
pkgconf \
267+
zig \
268+
gettext
171269
```
172270

173271
#### Void
174272

175273
```sh
176-
sudo xbps-install gtk4-devel libadwaita-devel pkg-config zig blueprint-compiler gettext
274+
sudo xbps-install \
275+
gtk4-devel \
276+
gtk4-layer-shell-devel \
277+
libadwaita-devel \
278+
pkg-config \
279+
zig \
280+
gettext
177281
```
178282

179-
### Broken Dependencies
180-
181-
#### Pango
182-
183-
If you are experiencing a segfault in `cairo_scaled_font_get_font_options`
184-
when running Ghostty, your Pango version may have a bug. See
185-
[this discussion on GitHub](https://github.com/ghostty-org/ghostty/discussions/3258#)
186-
for more information on how to resolve this.
187-
188283
### Installation Directory
189284

190285
Use `zig build` with the `-p` (prefix) flag to install Ghostty into
@@ -194,12 +289,11 @@ all work.
194289

195290
For local, unprivileged installs, we recommend `$HOME/.local`:
196291

197-
```
292+
```sh
198293
zig build -p $HOME/.local -Doptimize=ReleaseFast
199-
...
200294
```
201295

202-
With a typical Freedesktop-compatible desktop environment (i.e. Gnome,
296+
With a typical Freedesktop-compatible desktop environment (i.e. GNOME,
203297
KDE), this will make Ghostty available as an app in your app launcher.
204298
If you don't see it immediately you may have to log out and log back
205299
in or maybe even restart.

0 commit comments

Comments
 (0)