> Every Taji docs page as Markdown: https://docs.taji.is/llms.txt

# Build and run Taji from source

You finish with Taji's kernel built from this checkout, running windowed or headless. You need macOS 26 or later on Apple Silicon, Linux (builds on Debian 13, where the sandbox suite passes; CI runs the workspace tests on Ubuntu 24.04, but no installed build has been walked there), or Windows 11 24H2, build 26100.9278 or later (x64); a network, since the build downloads dependencies and keyless data sources read the internet; and disk and time: a cold build takes minutes and `target/` passes 10 GB. To use the app instead, [install it](https://docs.taji.is/guide/app.md). Run every command at the repository root, in Git Bash on Windows.

## Prerequisites

On Windows, do [Windows](#windows) first.

1. Install your platform's build tools, then `rustup`, `mise` and `uv`. `rustup` and `mise` fetch the pinned toolchain in step 3; `uv` lays Taji's Python in [Build](#build). Each installer's script asks you to follow its on-screen instructions.

   ```sh tab={"label":"macOS"}
   # macOS: the Command Line Tools, since `make dev` compiles the Touch ID helper with `xcrun swiftc`
   xcode-select --install
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
   curl -fsSL https://mise.run | sh
   curl -LsSf https://astral.sh/uv/install.sh | sh
   ```

   ```sh tab={"label":"Linux"}
   # Linux (Debian, Ubuntu)
   sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential bubblewrap slirp4netns iptables iproute2 ca-certificates curl git python3 xz-utils unzip
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
   curl -fsSL https://mise.run | sh
   curl -LsSf https://astral.sh/uv/install.sh | sh
   ```

   ```powershell tab={"label":"Windows"}
   # Windows, in PowerShell
   winget install Microsoft.VisualStudio.2022.BuildTools --override "--wait --passive --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
   winget install LLVM.LLVM
   winget install --id Git.Git -e
   winget install Rustlang.Rustup
   winget install jdx.mise
   winget install ezwinports.make
   winget install astral-sh.uv
   ```

   Open a new terminal (Git Bash on Windows) so the new tools are on `PATH`. mise must be 2026.11.15 or later, which reads `mise.lock`'s format; on Windows `winget upgrade jdx.mise` moves an older one.

2. Clone the repository and enter it.

   ```sh tab={"label":"macOS and Linux"}
   # macOS and Linux
   git clone https://github.com/TajiAI/Taji.git
   cd Taji
   ```

   ```sh tab={"label":"Windows"}
   # Windows, in Git Bash
   git config --global core.longpaths true
   git clone https://github.com/TajiAI/Taji.git
   cd Taji
   ```

3. Install the toolchain `.mise.toml` pins (Rust, Node, Go for the Tailscale sidecar, Bun and pnpm). Without mise, install Rust, Go 1.27, Node 22.13 or later, pnpm 12 and Bun 1.4 yourself.

   ```sh tab={"label":"macOS"}
   # macOS (zsh)
   eval "$(~/.local/bin/mise activate zsh)"
   mise trust
   mise install
   ```

   ```sh tab={"label":"Linux"}
   # Linux (bash)
   eval "$(~/.local/bin/mise activate bash)"
   mise trust
   mise install
   ```

   ```sh tab={"label":"Windows"}
   # Windows (Git Bash)
   eval "$(mise activate bash)"
   mise trust
   mise install
   ```

## Build

1. Set up the checkout:

   ```sh
   make setup
   ```

   It adds Rust's `wasm32-unknown-unknown` target, runs `pnpm install --frozen-lockfile`, unpacks Electron, installs the headless browser the gate scripts drive, and lays Taji's Python, Yahoo's and EDGAR's runtime, in `.python`. It ends with the interpreter `.python/python` (`python.exe` on Windows) in place.

2. Build the page, the window, the kernel and the sidecars the kernel spawns from its own directory, in this order: the kernel embeds the page, and a debug kernel spawns `window/`.

   ```sh tab={"label":"macOS"}
   # macOS
   pnpm --filter @taji/ui build
   pnpm --filter @taji/window build
   cargo build --locked -p taji-open
   make sidecar whatsapp unlock
   ```

   ```sh tab={"label":"Linux"}
   # Linux
   pnpm --filter @taji/ui build
   pnpm --filter @taji/window build
   cargo build --locked -p taji-open
   make sidecar whatsapp
   ```

   ```sh tab={"label":"Windows"}
   # Windows (Git Bash): libcxx.sh points the C++ build at V8's libc++
   source engine/crates/taji/scripts/libcxx.sh
   pnpm --filter @taji/ui build
   pnpm --filter @taji/window build
   cargo build --locked -p taji-open
   make sidecar whatsapp
   ```

   Cargo ends with `Finished`. The kernel is `target/debug/taji`, with `taji-tailscale` and `taji-whatsapp` beside it (`.exe` on Windows), and `taji-unlock` on macOS, the Touch ID helper.

## Run

1. **With the window.** `make dev` runs the builds above, then opens Taji's window.

   ```sh
   make dev
   ```

   `FRESH=1 make dev` starts empty, with state, store and home under `target/fresh` on port 7790, and never attaches to a kernel on 7780.

2. **Headless**, the wire the only client. `TAJI_WIRE=0` takes a free port, which the kernel writes to `wire-port` in its state dir, after its token:

   ```sh
   export TAJI_STATE_DIR=$(mktemp -d) TAJI_STORE_DIR=$(mktemp -d) TAJI_HOME=$(mktemp -d) TAJI_WIRE=0
   TAJI_HEADLESS=1 target/debug/taji &
   until [ -s "$TAJI_STATE_DIR/wire-token" ]; do sleep 1; done
   curl -H "x-taji-token: $(cat "$TAJI_STATE_DIR/wire-token")" "http://127.0.0.1:$(cat "$TAJI_STATE_DIR/wire-port")/read/desks"
   ```

   The kernel listens on `127.0.0.1` only. Each launch writes new tokens to the state dir, and every request carries `wire-token` as `x-taji-token` ([the wire](https://docs.taji.is/reference/wire.md)). One kernel runs per state dir and store. The answer lists the desks of the empty state, one active:

```json file="examples/install/desks.json"
[
  {
    "active": true,
    "created_at": 1796331819,
    "id": "01a23db8-4fff-7583-ae2b-b12000a08625",
    "last_active": 1796331819,
    "name": null,
    "notes": 0
  }
]
```

*Captured 2026-12-03 on a keyless headless kernel.*

3. Stop it, with the same variables set: `target/debug/taji quit` prints `taji quit: stopped Taji on 127.0.0.1:<port>`.

## Upgrade

Stop Taji ([below](#stop-and-reset)), `git pull` and build again; the state dir is kept.

Before 1.0 an upgrade can change the store's layout: the next start rebuilds an older store from `pulls.db`, and refuses one a newer Taji wrote (run that Taji, or delete the store dir's `taji.duckdb` to rebuild it). Never `make reset` for this: it deletes the state, store and home. What a version may change: [Compatibility](https://docs.taji.is/reference/compatibility.md).

## Stop and reset

- Stop one Taji: `target/debug/taji quit`. It reads `TAJI_WIRE` (default 7780) and the state dir's token. `POST /verb/ui/quit` does the same. Holding exits, it refuses, naming them; `taji quit --yes` stops them too.
- Stop every running Taji: `make down`.
- Start over: `make reset` lists the state, store and home it would delete and stops there. With Taji stopped, `YES=1 make reset` deletes them and removes Taji's MCP server and skill from every agent it finds.

Unless `TAJI_STATE_DIR`, `TAJI_STORE_DIR` and `TAJI_HOME` name them, they are:

| | State | Store | Home |
|---|---|---|---|
| macOS | `~/Library/Application Support/Taji` | `~/.local/share/taji/store` | `~/.taji` |
| Linux | `~/.local/share/taji` | `~/.local/share/taji/store` | `~/.taji` |
| Windows | `%LOCALAPPDATA%\Taji` | `%LOCALAPPDATA%\Taji\store` | `%USERPROFILE%\.taji` |

On Linux an absolute `$XDG_DATA_HOME` replaces `~/.local/share`.

## Windows

1. Update Windows to 24H2 build 26100.9278 or later (`winver` shows it). Process plugins and the Python sources (Yahoo, EDGAR) need a sandbox that [KB5120998](https://support.microsoft.com/en-us/servicing/os/windows-11/2026/08/kb5120998-windows-11-24h2-25h2-update) rolls out gradually, so a machine at that build may lack it; once built, Yahoo's and EDGAR's `GET /read/plugins` rows reading `enabled: true` and `reason: null` show it, where a machine without it reads `no sandbox: …`.
2. The Visual Studio workload `Microsoft.VisualStudio.Workload.VCTools` (the MSVC x64 tools and a Windows 11 SDK) comes with the Build Tools command above. LLVM 21 or later needs `C:\Program Files\LLVM\bin` on `PATH`.
3. `rustup`'s default host is `x86_64-pc-windows-msvc`.

You do not need NASM, CMake or Developer Mode. Build and run as above. The kernel is `taji.exe` in `target/debug/`, with `taji-tailscale.exe` and `taji-whatsapp.exe` beside it.

## Linux

- Process plugins and the Python sources (Yahoo, EDGAR) run only in the sandbox. [Security](https://docs.taji.is/architecture/security.md) holds the sandbox suite's results.
- On Ubuntu 24.04, allow unprivileged user namespaces for unprofiled programs: `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`.
- On Debian, add `/usr/sbin` to your `PATH`: `iptables` lives there.
- The vault opens by backup password alone.
- Closing the window leaves Taji running. GNOME shows its tray item only with the AppIndicator extension; without it, `taji ui` reopens Taji and `taji quit` stops it.
- To run plugins you wrote unconfined, use a debug build with `TAJI_UNSANDBOXED=1`.

## If it fails

- **`another Taji owns <dir>`, exit 0.** A kernel holds that state dir or store. Run `target/debug/taji quit` or `make down`, or give the second its own `TAJI_STATE_DIR` and `TAJI_STORE_DIR`.
- **`no sandbox: …` on every process plugin and Python source (Linux).** Bubblewrap, unprivileged user namespaces, `slirp4netns`, `iptables` or `ip` is missing or off, the message naming which. Nothing runs unconfined: fix the cause under [Linux](#linux).
- **`no sandbox: needs Windows' process isolation, …: run Windows Update` on every process plugin and Python source; the chart shows it for Yahoo's bars (Windows).** The build is below the floor or KB5120998's rollout has not reached it; nothing runs unconfined.
- **The linker is killed or the build runs out of memory.** Set `CARGO_BUILD_JOBS=2` (Linking with GNU ld is memory-hungry; this fits a 16 GB machine).

## Next

- [Quickstart](https://docs.taji.is/guide/first-session.md): a first order on the simulated broker.
- [Connect your agent](https://docs.taji.is/guide/agent.md): register Taji's MCP bridge from this checkout.
- [Configuration](https://docs.taji.is/reference/configuration.md): every variable, setting and file.
