# Install and Setup

This page covers the environment requirements,
supported install paths,
`b4` resolution,
and the first commands to verify a CRIEW installation.

## Prerequisites

- Rust stable
- Git
- Python 3
  Python 3 is required when CRIEW uses the repo-local `vendor/b4/b4.sh`
  or the embedded runtime fallback.
- `b4`
  CRIEW resolves `b4` in this order:
  `[b4].path` ->
  `CRIEW_B4_PATH` ->
  `./vendor/b4/b4.sh` ->
  the embedded runtime copy under `~/.criew/vendor/b4/b4.sh` ->
  `b4` in `PATH`.
- `git send-email`
  This is required only when you want to send replies.

Run `criew doctor` after installation.
It checks `b4`,
`git send-email`,
git mail identity,
and IMAP connectivity.

## Installation

### Install from crates.io

Use this as the default path:

```bash
cargo install criew
```

This build embeds a minimal vendored `b4` runtime.
If `[b4].path`,
`CRIEW_B4_PATH`,
and `./vendor/b4/b4.sh` are all unavailable,
CRIEW can materialize that fallback under `~/.criew/vendor/b4/` on first use.
Python 3 is still required for that fallback.

### Install from a clone

Use this when you want the checkout-local `./vendor/b4/b4.sh` fallback:

```bash
git clone --recurse-submodules https://github.com/ChenMiaoi/CRIEW.git
cd CRIEW
cargo install --path . --locked
```

If the repository is already cloned without submodules:

```bash
git submodule update --init --recursive
```

### Install directly from GitHub

```bash
cargo install --git https://github.com/ChenMiaoi/CRIEW.git --locked criew
```

In this mode,
provide `b4` through `b4.path`,
`CRIEW_B4_PATH`,
or your system `PATH`.
If the checkout also includes `vendor/b4`,
CRIEW can use it the same way as a source clone.

### Run from source

```bash
cargo run -- doctor
cargo run -- tui
```

## Runtime naming baseline

`v0.0.1` is the first supported public baseline.
From `v0.0.1` onward,
CRIEW supports only:

- `criew`
- `~/.criew/`
- `criew-config.toml`
- `criew.db`
- `CRIEW_B4_PATH`
- `CRIEW_IMAP_PROXY`

Courier-era names are not a supported upgrade path.
If you tested older pre-release snapshots,
refresh your checkout or reinstall the binary
and bootstrap a new CRIEW runtime directory with the CRIEW naming set.

## Verify the result

Run:

```bash
criew doctor
criew version
```

A `v0.0.2` release build should report `criew 0.0.2`
from `criew version`.

Success means:

- CRIEW starts without runtime bootstrap errors.
- `b4` resolves from a configured path,
  a vendored fallback,
  or `PATH`.
- `git send-email` is reported only if you plan to send replies.

## See also

- [Configuration](Configuration.md)
- [Sync and TUI](Sync-and-TUI.md)
- [Repository source](https://github.com/ChenMiaoi/CRIEW)
