# How to Set Up Kimi‑Code Locally: Install Methods and Developer Workflow

> Install Kimi-Code locally with our easy single-binary script or build from source using pnpm and Node 24+. Get started with local Kimi-Code development today.

- Repository: [Moonshot AI/kimi-code](https://github.com/MoonshotAI/kimi-code)
- Tags: how-to-guide
- Published: 2026-08-11

---

**You can install Kimi‑Code locally via a single‑binary install script (no Node.js required) or build it from source using pnpm and Node 24+.**

Kimi‑Code is a TypeScript monorepo developed by MoonshotAI that bundles a terminal UI (TUI) agent, a backend server, and a plugin ecosystem into a cohesive AI coding assistant. This guide walks through both **end‑user installation** and **contributor setup**, referencing the exact source files and build system defined in the repository.

## Prerequisites and System Requirements

Before installing, verify your environment matches the repository requirements enforced in [[`package.json`](https://github.com/MoonshotAI/kimi-code/blob/main/package.json)](https://github.com/MoonshotAI/kimi-code/blob/main/package.json) and [`.nvmrc`](https://github.com/MoonshotAI/kimi-code/blob/main/.nvmrc):

| Component | Minimum Version | Notes |
|-----------|---------------|-------|
| Node.js | 24.15.0 | Required only for source builds; the install script bundles its own runtime |
| pnpm | 9.x+ | Used as the workspace manager (see [[`pnpm-workspace.yaml`](https://github.com/MoonshotAI/kimi-code/blob/main/pnpm-workspace.yaml)](https://github.com/MoonshotAI/kimi-code/blob/main/pnpm-workspace.yaml)) |
| Git | Any | Windows users need **Git for Windows**; set `KIMI_SHELL_PATH` if bash.exe is non‑standard |

## Installation Method 1: Install Script (Recommended for End Users)

The fastest way to set up Kimi‑Code locally is the pre‑built binary distribution. This method downloads the correct artifact for your platform and requires no local Node.js installation.

### macOS and Linux

```bash
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash

```

### Windows PowerShell

```powershell
irm https://code.kimi.com/kimi-code/install.ps1 | iex

```

The script places the `kimi` binary on your `PATH`. Verify the installation:

```bash
kimi --version

```

Launch the interactive TUI:

```bash
cd your-project-directory
kimi

```

## First‑Run Authentication

After launching the CLI, authenticate with Moonshot AI:

1. Inside the TUI, type `/login`
2. Choose **OAuth** for browser‑based sign‑in, or paste a **Moonshot AI Open Platform API key**

Authentication state is stored locally and reused across sessions.

## Installation Method 2: Build From Source (Contributors and Custom Builds)

To modify Kimi‑Code or run bleeding‑edge features, clone the monorepo and bootstrap with pnpm.

### Step 1: Clone and Install Dependencies

```bash
git clone https://github.com/MoonshotAI/kimi-code.git
cd kimi-code
pnpm install

```

The install command resolves all workspace packages across `apps/`, `packages/`, and `plugins/`.

### Step 2: Run the CLI in Development Mode

```bash
pnpm dev:cli

```

This launches the `kimi` binary with hot‑reloading enabled. Changes to TypeScript source files trigger automatic recompilation.

### Step 3: Run Tests and Type Checks

```bash
pnpm typecheck  # Full TypeScript type checking across the monorepo

pnpm test       # Execute the test suite

pnpm lint       # Run ESLint rules

pnpm build      # Production build for all packages

```

## Monorepo Architecture Overview

Understanding the directory structure helps when debugging local setup issues or extending functionality.

### Key Packages and Apps

| Path | Purpose |
|------|---------|
| [`apps/kimi-code`](https://github.com/MoonshotAI/kimi-code/tree/main/apps/kimi-code) | Main CLI binary; entry point for the `kimi` command |
| [`apps/kimi-inspect`](https://github.com/MoonshotAI/kimi-code/tree/main/apps/kimi-inspect) | Web‑based debugging inspector for server sessions |
| [`packages/agent-core-v2`](https://github.com/MoonshotAI/kimi-code/tree/main/packages/agent-core-v2) | Agent engine with **LifecycleScope** hierarchy (App → Workspace → Session → Agent |
| [`packages/kap-server`](https://github.com/MoonshotAI/kimi-code/tree/main/packages/kap-server) | Backend server exposing REST/WebSocket APIs and debug RPC |
| [`packages/node-sdk`](https://github.com/MoonshotAI/kimi-code/tree/main/packages/node-sdk) | Official Node.js SDK for programmatic access |
| [`packages/klient`](https://github.com/MoonshotAI/kimi-code/tree/main/packages/klient), [`packages/kosong`](https://github.com/MoonshotAI/kimi-code/tree/main/packages/kosong) | Low‑level client utilities and shared primitives |
| [`plugins/official/`](https://github.com/MoonshotAI/kimi-code/tree/main/plugins/official) | Curated plugins implementing skills, data sources, and web bridges |
| [`packages/pi-tui`](https://github.com/MoonshotAI/kimi-code/tree/main/packages/pi-tui) | Internal TUI library powering the terminal interface |

### Build System Details

- **Workspace definition**: [[`pnpm-workspace.yaml`](https://github.com/MoonshotAI/kimi-code/blob/main/pnpm-workspace.yaml)](https://github.com/MoonshotAI/kimi-code/blob/main/pnpm-workspace.yaml) declares all package globs
- **TypeScript configuration**: Each package extends shared compiler options; strict null checks and path mapping are enabled
- **Plugin discovery**: At runtime, the CLI scans `plugins/official/` and loads modules that export a [`SKILL.md`](https://github.com/MoonshotAI/kimi-code/blob/main/SKILL.md) manifest

## Windows‑Specific Configuration

The Kimi‑Code CLI shells out to Git Bash for external command execution. If Git for Windows is installed in a non‑standard location, export the path before running `kimi`:

```powershell
$env:KIMI_SHELL_PATH = "C:\Custom\Path\Git\bin\bash.exe"
kimi

```

Permanent configuration via System Environment Variables is also supported.

## Summary

- **End users** should run the platform‑specific install script—no Node.js or build tools needed
- **Contributors** need **Node 24.15.0+** and **pnpm 9+**; clone, `pnpm install`, and `pnpm dev:cli` to start hacking
- The monorepo splits concerns across `apps/` (binaries), `packages/` (libraries), and `plugins/` (extensions)
- Authentication happens inside the TUI via `/login` with OAuth or API key

## Frequently Asked Questions

### Where is the Kimi‑Code install script hosted?

The install scripts live at `https://code.kimi.com/kimi-code/install.sh` (macOS/Linux) and `https://code.kimi.com/kimi-code/install.ps1` (Windows). These URLs are the official distribution points referenced in the [README.md](https://github.com/MoonshotAI/kimi-code/blob/main/README.md).

### Can I run Kimi‑Code without installing Node.js?

Yes. The install script downloads a self‑contained binary that bundles the Node.js runtime. Node.js is only required when building from source or developing plugins.

### How do I switch between production and development builds?

Production builds use the `kimi` command installed by the script. For development, run `pnpm dev:cli` from the repository root—the command bootstraps the CLI with hot‑reloading and links against local package sources.

### What if the TUI fails to launch on Windows?

Ensure Git for Windows is installed and accessible. Set the `KIMI_SHELL_PATH` environment variable to the full path of `bash.exe` if the CLI cannot locate it automatically.