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
2023-10-30 05:07:29 +00:00
#### From Source
2023-08-13 07:31:20 +00:00
2024-10-19 21:40:04 +00:00
First make sure that you have a Rust version >= 1.76 and that the `libssl-dev` ,
`openssl` , `pkg-config` , and `build-essential` packages are 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
```
2024-06-09 06:46:22 +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-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
```
2024-08-20 07:49:54 +00:00
#### Gentoo Linux
`dev-vcs/jj` is available in the [GURU ](https://wiki.gentoo.org/wiki/Project:GURU ) repository.
Details on how to enable the GURU repository can be found [here ](https://wiki.gentoo.org/wiki/Project:GURU/Information_for_End_Users ).
Once you have synced the GURU repository, you can install `dev-vcs/jj` via Portage:
```
emerge -av dev-vcs/jj
```
2023-08-13 07:31:20 +00:00
### Mac
2024-07-26 02:25:02 +00:00
#### From Source, Vendored OpenSSL
2024-10-19 21:40:04 +00:00
First make sure that you have a Rust version >= 1.76. You may also need to run:
2024-07-26 02:25:02 +00:00
```shell
xcode-select --install
```
Now run either:
```shell
# To install the *prerelease* version from the main branch
cargo install --git https://github.com/martinvonz/jj.git \
--features vendored-openssl --locked --bin jj jj-cli
```
or:
```shell
# To install the latest release
2024-10-25 21:40:07 +00:00
cargo install --features vendored-openssl --locked --bin jj jj-cli
2024-07-26 02:25:02 +00:00
```
#### From Source, Homebrew OpenSSL
2023-08-13 07:31:20 +00:00
2024-10-19 21:40:04 +00:00
First make sure that you have a Rust version >= 1.76. You will also need
[Homebrew ](https://brew.sh/ ) installed. You may then need to run some or all of
these:
2023-08-13 07:31:20 +00:00
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
2024-10-19 21:40:04 +00:00
First make sure that you have a Rust version >= 1.76. 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 --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
2024-10-30 11:41:19 +00:00
Improved completions are currently in the works, these will complete things
like bookmark names as well. You can activate them with the alternative "dynamic"
instructions below. Please let us know if you encounter any issues, so we can
ensure a smooth transition once we default to these new completions. If you
have ideas about specific completions that could be added, please share them
[here ](https://github.com/martinvonz/jj/issues/4763 ).
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
```
2024-10-30 11:41:19 +00:00
dynamic:
```shell
echo "source < (COMPLETE=bash jj)" >> ~/.bashrc
```
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
```
2024-10-30 11:41:19 +00:00
dynamic:
```shell
echo "source < (COMPLETE=zsh jj)" >> ~/.zshrc
```
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-10-30 11:41:19 +00:00
dynamic:
```shell
echo "source (COMPLETE=fish jj | psub)" >> ~/.config/fish/config.fish
```
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`
```
2024-10-30 11:41:19 +00:00
(dynamic completions not available yet)
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)
```
2024-10-30 11:41:19 +00:00
(dynamic completions not available yet)