Debian Codegraph @

docs/install-and-setup.md

raw
1 # Installation and setup
2
3 ## Installation
4
5 ### Download pre-built binaries for a release
6
7 There are [pre-built binaries] of the last released version of `jj` for
8 Windows, Mac, or Linux (the "musl" version should work on all distributions).
9
10 #### Cargo Binstall
11
12 If you use [`cargo-binstall`][cargo-binstall], you
13 can install binaries of the latest `jj` release from GitHub as follows:
14
15 ```shell
16 # Will put the jj binary for the latest release in ~/.cargo/bin by default
17 cargo binstall --strategies crate-meta-data jj-cli
18 ```
19
20 Without the `--strategies` option, you may get equivalent binaries that should
21 be compiled from the same source code.
22
23 !!! note
24
25 If you'd like to install a prerelease version, you'll need to use one of the
26 options below.
27
28 ### Linux
29
30 #### From Source
31
32 First make sure that you have a Rust version >= 1.88 and that the
33 `build-essential` package is installed by running something like this:
34
35 ```shell
36 sudo apt-get install build-essential
37 ```
38
39 Now run either:
40
41 ```shell
42 # To install the *prerelease* version from the main branch
43 cargo install --git https://github.com/jj-vcs/jj.git --locked --bin jj jj-cli
44 ```
45
46 or:
47
48 ```shell
49 # To install the latest release
50 cargo install --locked --bin jj jj-cli
51 ```
52
53 #### Arch Linux
54 You can install the `jujutsu` package from the [official extra repository](https://archlinux.org/packages/extra/x86_64/jujutsu/):
55
56 ```shell
57 pacman -S jujutsu
58 ```
59
60 Or install from the [AUR repository](https://aur.archlinux.org/packages/jujutsu-git) with an [AUR Helper](https://wiki.archlinux.org/title/AUR_helpers):
61
62 ```shell
63 yay -S jujutsu-git
64 ```
65
66 #### NixOS
67
68 If you're on NixOS you can install a **released** version of `jj` using the
69 [nixpkgs `jujutsu` package](https://search.nixos.org/packages?channel=unstable&show=jujutsu).
70
71 To install a **prerelease** version, you can use the flake for this repository.
72 For example, if you want to run `jj` loaded from the flake, use:
73
74 ```shell
75 nix run 'github:jj-vcs/jj'
76 ```
77
78 You can also add this flake url to your system input flakes. Or you can
79 install the flake to your user profile:
80
81 ```shell
82 # Installs the prerelease version from the main branch
83 nix profile install 'github:jj-vcs/jj'
84 ```
85
86 #### Homebrew
87
88 If you use Homebrew, you can run:
89
90 ```shell
91 # Installs the latest release
92 brew install jj
93 ```
94
95 #### Gentoo Linux
96
97 `dev-vcs/jj` is available in the [GURU](https://wiki.gentoo.org/wiki/Project:GURU) repository.
98 Details on how to enable the GURU repository can be found [here](https://wiki.gentoo.org/wiki/Project:GURU/Information_for_End_Users).
99
100 Once you have synced the GURU repository, you can install `dev-vcs/jj` via Portage:
101
102 ```shell
103 emerge -av dev-vcs/jj
104 ```
105
106 #### openSUSE Tumbleweed
107
108 `jujutsu` can be installed from the official [openSUSE-Tumbleweed-Oss](http://download.opensuse.org/tumbleweed/repo/oss/) repository:
109
110 ```shell
111 zypper install jujutsu
112 ```
113
114 #### Fedora Linux
115
116 `jujutsu` has an unofficial [COPR
117 repo](https://copr.fedorainfracloud.org/coprs/aldantanneo/jj-vcs) for Fedora:
118
119 ```shell
120 sudo dnf copr enable aldantanneo/jj-vcs
121 sudo dnf install jj-cli
122 ```
123
124 ### Mac
125
126 #### From Source
127
128 First make sure that you have a Rust version >= 1.88. You may also need to run:
129
130 ```shell
131 xcode-select --install
132 ```
133
134 Now run either:
135
136 ```shell
137 # To install the *prerelease* version from the main branch
138 cargo install --git https://github.com/jj-vcs/jj.git \
139 --locked --bin jj jj-cli
140 ```
141
142 or:
143
144 ```shell
145 # To install the latest release
146 cargo install --locked --bin jj jj-cli
147 ```
148
149 #### Homebrew
150
151 If you use Homebrew, you can run:
152
153 ```shell
154 # Installs the latest release
155 brew install jj
156 ```
157
158 #### MacPorts
159
160 You can also install `jj` via [the MacPorts `jujutsu`
161 port][macports]:
162
163 ```shell
164 # Installs the latest release
165 sudo port install jujutsu
166 ```
167
168 ### Windows
169
170 First make sure that you have a Rust version >= 1.88. Now run either:
171
172 ```shell
173 # To install the *prerelease* version from the main branch
174 cargo install --git https://github.com/jj-vcs/jj.git --locked --bin jj jj-cli
175 ```
176
177 or:
178
179 ```shell
180 # To install the latest release
181 cargo install --locked --bin jj jj-cli
182 ```
183
184 via winget:
185
186 ```shell
187 # To install the latest release via winget
188 winget install jj-vcs.jj
189 ```
190
191 via scoop:
192
193 ```shell
194 # To install the latest release via scoop
195 scoop install main/jj
196 ```
197
198 ### FreeBSD
199
200 `devel/jujutsu` is [available](https://www.freshports.org/devel/jujutsu) in the ports.
201
202 Install pre-built pkg:
203
204 ```shell
205 # To install the latest release via pkg
206 pkg install jujutsu
207 ```
208
209 Install from building the port:
210
211 ```shell
212 # To install the latest release via ports
213 cd /usr/ports/devel/jujutsu/ && make install clean
214 ```
215
216 ## Runtime Requirements
217
218 You will need git 2.41.0 or above. On older systems (e.g. Debian 11, Ubuntu
219 22.04) you will need to [upgrade Git](https://git-scm.com/install/).
220
221 ## Initial configuration
222
223 You may want to configure your name and email so commits are made in your name.
224
225 ```shell
226 $ jj config set --user user.name "Martin von Zweigbergk"
227 $ jj config set --user user.email "[email protected]"
228 ```
229
230 ## Command-line completion
231
232 Jujutsu provides 2 different command-line completion scripts.
233
234 ### Standard completions
235
236 The standard completion script provides completions for `jj` subcommands and
237 options.
238
239 ### Dynamic completions
240
241 The dynamic completion script provides completions for `jj` subcommands and
242 options, as well as additional completions, including bookmarks,
243 aliases, revisions, operations and files. Dynamic completions can be context
244 aware, for example they respect the global flags `--repository` and
245 `--at-operation` as well as some command-specific ones like `--revision`,
246 `--from`, and `--to`.
247
248 Dynamic completions are not the default/only option since the underlying engine
249 [is still labeled unstable][clap]. We expect to transition to them as the
250 default once the engine is stabilized. Please let us know if you encounter any
251 issues with dynamic completions.
252
253 !!! info "Which completion script should I use?"
254
255 Generally, dynamic completions provide a much better completion experience.
256 Although the underlying engine is deemed unstable, there have not been many
257 issues in practice. Dynamic completions are the preferred option for many
258 contributors and users.
259
260 We recommend using the dynamic completion script, and falling back to the
261 standard completion script if there are any issues.
262
263 <!-- The content tabs formatting below is optimized for the website and not for GitHub. -->
264
265 ### Bash
266
267 === "Standard"
268
269 ```shell
270 source <(jj util completion bash)
271 ```
272
273 === "Dynamic"
274
275 ```shell
276 source <(COMPLETE=bash jj)
277 ```
278
279 ### Zsh
280
281 === "Standard"
282
283 ```shell
284 autoload -U compinit
285 compinit
286 source <(jj util completion zsh)
287 ```
288
289 === "Dynamic"
290
291 ```shell
292 source <(COMPLETE=zsh jj)
293 ```
294
295 ### Fish
296
297 === "Standard"
298
299 ```shell
300 jj util completion fish | source
301 ```
302
303 === "Dynamic"
304
305 !!! note
306
307 No configuration is required with fish >= 4.0.2 which loads dynamic completions by default.
308
309 ```shell
310 COMPLETE=fish jj | source
311 ```
312
313 ### Nushell
314
315 === "Standard"
316
317 ```nu
318 jj util completion nushell | save -f completions-jj.nu
319 use completions-jj.nu * # Or `source completions-jj.nu`
320 ```
321
322 ### Powershell
323
324 === "Standard"
325
326 ```powershell
327 jj util completion power-shell | Out-String | Invoke-Expression
328 ```
329
330 === "Dynamic"
331
332 ```powershell
333 $env:COMPLETE = "powershell"
334 jj | Out-String | Invoke-Expression
335 Remove-Item Env:\COMPLETE
336 ```
337
338 Insert the above into your `$PROFILE` file
339 (usually `$HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`).
340
341 !!! note
342
343 Note that to execute scripts in PowerShell on Windows, including `$PROFILE`,
344 the [execution policy][ExecutionPolicies] needs to be set to `RemoteSigned`
345 at minimum.
346
347 [cargo-binstall]: https://github.com/cargo-bins/cargo-binstall
348 [clap]: https://github.com/clap-rs/clap/issues/3166
349 [Homebrew]: https://brew.sh/
350 [macports]: https://ports.macports.org/port/jujutsu/
351 [pre-built binaries]: https://github.com/jj-vcs/jj/releases/latest
352 [ExecutionPolicies]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies