2023-08-13 07:31:20 +00:00
# Installation and setup
## Installation
2023-09-11 05:03:41 +00:00
### Download pre-built binaries for a release
2023-08-13 07:31:20 +00:00
2023-09-11 05:03:41 +00:00
There are [pre-built binaries ](https://github.com/martinvonz/jj/releases/latest )
of the last released version of `jj` for Windows, Mac, or Linux (the "musl"
version should work on all distributions).
If you'd like to install a prerelease version, you'll need to use one of the
options below.
2023-08-13 07:31:20 +00:00
2024-03-14 01:42:53 +00:00
#### Cargo Binstall
2023-09-20 05:54:42 +00:00
If you use [`cargo-binstall` ](https://github.com/cargo-bins/cargo-binstall ), you
can install the same binaries of the last `jj` release from GitHub as follows:
```shell
# Will put the jj binary for the latest release in ~/.cargo/bin by default
2023-11-22 02:54:47 +00:00
cargo binstall --strategies crate-meta-data jj-cli
2023-09-20 05:54:42 +00:00
```
2023-11-22 02:54:47 +00:00
Without the `--strategies` option, you may get equivalent binaries that should
be compiled from the same source code.
2023-09-20 05:54:42 +00:00
2023-09-11 05:03:41 +00:00
### Linux
2023-08-13 07:31:20 +00:00
2024-03-14 01:42:53 +00:00
### Arch Linux
You can install the `jujutsu` package from the [official extra repository ](https://archlinux.org/packages/extra/x86_64/jujutsu/ ):
```
pacman -S jujutsu
```
Or install from the [AUR repository ](https://aur.archlinux.org/packages/jujutsu-git ) with an [AUR Helper ](https://wiki.archlinux.org/title/AUR_helpers ):
```
yay -S jujutsu-git
```
2023-10-30 05:07:29 +00:00
#### From Source
2023-08-13 07:31:20 +00:00
2023-10-05 02:04:18 +00:00
First make sure that you have the `libssl-dev` , `openssl` , `pkg-config` , and
`build-essential` packages installed by running something like this:
2023-08-13 07:31:20 +00:00
2023-08-13 01:38:57 +00:00
```shell
2023-10-05 02:04:18 +00:00
sudo apt-get install libssl-dev openssl pkg-config build-essential
2023-08-13 07:31:20 +00:00
```
2023-09-11 05:03:41 +00:00
Now run either:
2023-08-13 07:31:20 +00:00
2023-08-13 01:38:57 +00:00
```shell
2023-09-11 05:03:41 +00:00
# To install the *prerelease* version from the main branch
2023-08-13 07:31:20 +00:00
cargo install --git https://github.com/martinvonz/jj.git --locked --bin jj jj-cli
```
2023-09-11 05:03:41 +00:00
or:
```shell
# To install the latest release
cargo install --locked --bin jj jj-cli
```
2023-08-13 07:31:20 +00:00
#### Nix OS
2023-09-11 05:03:41 +00:00
If you're on Nix OS you can install a **released** version of `jj` using the
[nixpkgs `jujutsu` package ](https://search.nixos.org/packages?channel=unstable&show=jujutsu ).
To install a **prerelease** version, you can use the flake for this repository.
2023-08-13 07:31:20 +00:00
For example, if you want to run `jj` loaded from the flake, use:
2023-08-13 01:38:57 +00:00
```shell
2023-08-13 07:31:20 +00:00
nix run 'github:martinvonz/jj'
```
You can also add this flake url to your system input flakes. Or you can
install the flake to your user profile:
2023-08-13 01:38:57 +00:00
```shell
2023-09-11 05:03:41 +00:00
# Installs the prerelease version from the main branch
2023-08-13 07:31:20 +00:00
nix profile install 'github:martinvonz/jj'
```
#### Homebrew
If you use linuxbrew, you can run:
2023-08-13 01:38:57 +00:00
```shell
2023-09-11 05:03:41 +00:00
# Installs the latest release
2023-08-13 07:31:20 +00:00
brew install jj
```
### Mac
#### From Source
You may need to run some or all of these:
2023-08-13 01:38:57 +00:00
```shell
2023-08-13 07:31:20 +00:00
xcode-select --install
brew install openssl
brew install pkg-config
export PKG_CONFIG_PATH="$(brew --prefix)/opt/openssl@3/lib/pkgconfig"
```
2023-09-11 05:03:41 +00:00
Now run either:
2023-08-13 07:31:20 +00:00
2023-08-13 01:38:57 +00:00
```shell
2023-09-11 05:03:41 +00:00
# To install the *prerelease* version from the main branch
2023-08-13 07:31:20 +00:00
cargo install --git https://github.com/martinvonz/jj.git --locked --bin jj jj-cli
```
2023-09-11 05:03:41 +00:00
or:
```shell
# To install the latest release
cargo install --locked --bin jj jj-cli
```
2023-10-30 05:07:29 +00:00
#### Homebrew
If you use Homebrew, you can run:
```shell
# Installs the latest release
brew install jj
```
#### MacPorts
You can also install `jj` via [the MacPorts `jujutsu`
port](https://ports.macports.org/port/jujutsu/):
```shell
# Installs the latest release
sudo port install jujutsu
```
2023-09-11 05:03:41 +00:00
2023-08-13 07:31:20 +00:00
### Windows
2023-09-11 05:03:41 +00:00
Run either:
2023-08-13 07:31:20 +00:00
2023-08-13 01:38:57 +00:00
```shell
2023-09-11 05:03:41 +00:00
# To install the *prerelease* version from the main branch
2023-08-13 07:31:20 +00:00
cargo install --git https://github.com/martinvonz/jj.git --locked --bin jj jj-cli --features vendored-openssl
```
2023-09-11 05:03:41 +00:00
or:
```shell
# To install the latest release
cargo install --locked --bin jj jj-cli --features vendored-openssl
```
2023-08-13 07:31:20 +00:00
## Initial configuration
You may want to configure your name and email so commits are made in your name.
2023-08-13 01:38:57 +00:00
```shell
2023-08-13 07:31:20 +00:00
$ jj config set --user user.name "Martin von Zweigbergk"
$ jj config set --user user.email "martinvonz@google.com"
```
## Command-line completion
To set up command-line completion, source the output of
2024-02-16 22:13:08 +00:00
`jj util completion bash/zsh/fish` . Exactly how to source it
2023-09-06 20:50:37 +00:00
depends on your shell.
2023-08-13 07:31:20 +00:00
### Bash
2023-08-13 01:38:57 +00:00
```shell
2024-04-02 15:23:09 +00:00
source < (jj util completion bash)
2023-08-13 07:31:20 +00:00
```
### Zsh
2023-08-13 01:38:57 +00:00
```shell
2023-08-13 07:31:20 +00:00
autoload -U compinit
compinit
2024-02-16 22:13:08 +00:00
source < (jj util completion zsh)
2023-08-13 07:31:20 +00:00
```
### Fish
2023-08-13 01:38:57 +00:00
```shell
2024-02-16 22:13:08 +00:00
jj util completion fish | source
2023-08-13 07:31:20 +00:00
```
2024-02-16 20:23:41 +00:00
### Nushell
```nu
jj util completion nushell | save completions-jj.nu
use completions-jj.nu * # Or `source completions-jj.nu`
```
2023-08-13 07:31:20 +00:00
### Xonsh
2023-08-13 01:38:57 +00:00
```shell
2023-08-13 07:31:20 +00:00
source-bash $(jj util completion)
```