just playing with tangled
1# Installation and setup
2
3
4## Installation
5
6### Download pre-built binaries for a release
7
8There are [pre-built binaries] of the last released version of `jj` for
9Windows, Mac, or Linux (the "musl" version should work on all distributions).
10
11#### Cargo Binstall
12
13If you use [`cargo-binstall`][cargo-binstall], you
14can install binaries of the latest `jj` release from GitHub as follows:
15
16```shell
17# Will put the jj binary for the latest release in ~/.cargo/bin by default
18cargo binstall --strategies crate-meta-data jj-cli
19```
20
21Without the `--strategies` option, you may get equivalent binaries that should
22be compiled from the same source code.
23
24!!! note
25
26 If you'd like to install a prerelease version, you'll need to use one of the
27 options below.
28
29### Linux
30
31#### From Source
32
33First make sure that you have a Rust version >= 1.84 and that the `libssl-dev`,
34`openssl`, `pkg-config`, and `build-essential` packages are installed by running
35something like this:
36
37```shell
38sudo apt-get install libssl-dev openssl pkg-config build-essential
39```
40
41Now run either:
42
43```shell
44# To install the *prerelease* version from the main branch
45cargo install --git https://github.com/jj-vcs/jj.git --locked --bin jj jj-cli
46```
47
48or:
49
50```shell
51# To install the latest release
52cargo install --locked --bin jj jj-cli
53```
54
55#### Arch Linux
56You can install the `jujutsu` package from the [official extra repository](https://archlinux.org/packages/extra/x86_64/jujutsu/):
57
58```shell
59pacman -S jujutsu
60```
61
62Or install from the [AUR repository](https://aur.archlinux.org/packages/jujutsu-git) with an [AUR Helper](https://wiki.archlinux.org/title/AUR_helpers):
63
64```shell
65yay -S jujutsu-git
66```
67
68#### NixOS
69
70If you're on NixOS you can install a **released** version of `jj` using the
71[nixpkgs `jujutsu` package](https://search.nixos.org/packages?channel=unstable&show=jujutsu).
72
73To install a **prerelease** version, you can use the flake for this repository.
74For example, if you want to run `jj` loaded from the flake, use:
75
76```shell
77nix run 'github:jj-vcs/jj'
78```
79
80You can also add this flake url to your system input flakes. Or you can
81install the flake to your user profile:
82
83```shell
84# Installs the prerelease version from the main branch
85nix profile install 'github:jj-vcs/jj'
86```
87
88#### Homebrew
89
90If you use Homebrew, you can run:
91
92```shell
93# Installs the latest release
94brew install jj
95```
96
97#### Gentoo Linux
98
99`dev-vcs/jj` is available in the [GURU](https://wiki.gentoo.org/wiki/Project:GURU) repository.
100Details on how to enable the GURU repository can be found [here](https://wiki.gentoo.org/wiki/Project:GURU/Information_for_End_Users).
101
102Once you have synced the GURU repository, you can install `dev-vcs/jj` via Portage:
103
104```shell
105emerge -av dev-vcs/jj
106```
107
108### Mac
109
110#### From Source, Vendored OpenSSL
111
112First make sure that you have a Rust version >= 1.84. You may also need to run:
113
114```shell
115xcode-select --install
116```
117
118Now run either:
119
120```shell
121# To install the *prerelease* version from the main branch
122cargo install --git https://github.com/jj-vcs/jj.git \
123 --features vendored-openssl --locked --bin jj jj-cli
124```
125
126or:
127
128```shell
129# To install the latest release
130cargo install --features vendored-openssl --locked --bin jj jj-cli
131```
132
133#### From Source, Homebrew OpenSSL
134
135First make sure that you have a Rust version >= 1.84. You will also need
136[Homebrew] installed. You may then need to run some or all of
137these:
138
139```shell
140xcode-select --install
141brew install openssl
142brew install pkg-config
143export PKG_CONFIG_PATH="$(brew --prefix)/opt/openssl@3/lib/pkgconfig"
144```
145
146Now run either:
147
148```shell
149# To install the *prerelease* version from the main branch
150cargo install --git https://github.com/jj-vcs/jj.git --locked --bin jj jj-cli
151```
152
153or:
154
155```shell
156# To install the latest release
157cargo install --locked --bin jj jj-cli
158```
159
160
161#### Homebrew
162
163If you use Homebrew, you can run:
164
165```shell
166# Installs the latest release
167brew install jj
168```
169
170#### MacPorts
171
172You can also install `jj` via [the MacPorts `jujutsu`
173port][macports]:
174
175```shell
176# Installs the latest release
177sudo port install jujutsu
178```
179
180### Windows
181
182First make sure that you have a Rust version >= 1.84. Now run either:
183
184```shell
185# To install the *prerelease* version from the main branch
186cargo install --git https://github.com/jj-vcs/jj.git --locked --bin jj jj-cli --features vendored-openssl
187```
188
189or:
190
191```shell
192# To install the latest release
193cargo install --locked --bin jj jj-cli --features vendored-openssl
194```
195
196
197## Initial configuration
198
199You may want to configure your name and email so commits are made in your name.
200
201```shell
202$ jj config set --user user.name "Martin von Zweigbergk"
203$ jj config set --user user.email "martinvonz@google.com"
204```
205
206## Command-line completion
207
208To set up command-line completion, source the output of
209`jj util completion bash/zsh/fish`. Exactly how to source it
210depends on your shell.
211
212Improved completions are also available. They will complete things like
213bookmarks, aliases, revisions, operations and files. They can be context aware,
214for example they respect the global flags `--repository` and `--at-operation` as
215well as some command-specific ones like `--revision`, `--from` and `--to`. You
216can activate them with the alternative "dynamic" instructions below. They should
217still complete everything the static completions did, so only activate one of
218them. Please let us know if you encounter any issues, so we can ensure a smooth
219transition once we default to these new completions.
220
221!!! info "Why are the improved completions not the default?"
222
223 To generate the dynamic completion script, execute `jj` with `$COMPLETE` set
224 to the name of your shell (see examples below). See the upstream clap issue
225 [#3166][clap] for the explanation.
226
227
228### Bash
229
230#### Standard
231
232```shell
233source <(jj util completion bash)
234```
235
236#### Dynamic
237
238```shell
239source <(COMPLETE=bash jj)
240```
241
242### Zsh
243
244#### Standard
245
246```shell
247autoload -U compinit
248compinit
249source <(jj util completion zsh)
250```
251
252#### Dynamic
253
254```shell
255source <(COMPLETE=zsh jj)
256```
257
258### Fish
259
260!!! note
261
262 No configuration is required with fish >= 4.1 which loads dynamic completions by default.
263
264#### Standard
265
266```shell
267jj util completion fish | source
268```
269
270#### Dynamic
271
272```shell
273COMPLETE=fish jj | source
274```
275
276### Nushell
277
278```nu
279jj util completion nushell | save completions-jj.nu
280use completions-jj.nu * # Or `source completions-jj.nu`
281```
282
283(dynamic completions not available yet)
284
285### Xonsh
286
287```shell
288source-bash $(jj util completion)
289```
290
291(dynamic completions not available yet)
292
293### Powershell
294
295Insert this line in your $PROFILE file:
296(usually $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1)
297
298```shell
299Invoke-Expression (& { (jj util completion power-shell | Out-String) })
300```
301
302(dynamic completions not available yet)
303
304[cargo-binstall]: https://github.com/cargo-bins/cargo-binstall
305[clap]: https://github.com/clap-rs/clap/issues/3166
306[Homebrew]: https://brew.sh/
307[macports]: https://ports.macports.org/port/jujutsu/
308[pre-built binaries]: https://github.com/jj-vcs/jj/releases/latest