# Prerequisites for Installing codebase-memory-mcp: Build Requirements and Setup Guide

> Learn the prerequisites for installing codebase-memory-mcp from source. Discover the C/C++ compiler, zlib, and Git build requirements for a successful setup.

- Repository: [Martin Vogel/codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp)
- Tags: how-to-guide
- Published: 2026-07-09

---

**Installing codebase-memory-mcp requires no runtime dependencies when using pre-built binaries, but building from source requires a C/C++ compiler toolchain, zlib development headers, and Git.**

The `codebase-memory-mcp` tool from DeusData is a pure-C application that powers in-memory code indexing. While you can download pre-built binaries that run standalone, compiling the project from source—located in the `internal/cbm/` directory—requires specific development dependencies to generate the static binary at `build/c/codebase-memory-mcp`.

## Pre-Built Binary vs. Source Compilation

You have two installation paths with vastly different requirements:

- **Pre-built binaries**: Zero runtime dependencies. Download, extract, and run immediately.
- **Build from source**: Requires a development toolchain to compile the C engine and optional UI components as defined in [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) and `Makefile.cbm`.

Choose source compilation only if you need custom builds or are contributing to the repository.

## Prerequisites for Building from Source

When compiling locally, your system must provide these four core components:

- **C compiler** (`gcc` or `clang`): Compiles the core engine source files in `internal/cbm/` that handle AST extraction and graph construction.
- **C++ compiler** (`g++` or `clang++`): Required for helper components and the optional UI build process.
- **zlib development headers**: Powers the LZ4 and SQLite pipeline used for the in-memory index. On Linux, this is typically `zlib1g-dev`.
- **Git**: Required for cloning the repository and used by the [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) wrapper for version detection.

**Optional but recommended**: `make` and `bash`, which are used by the provided build wrapper at [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) (line references indicate this script orchestrates the entire compilation).

## Platform-Specific Installation Commands

### macOS Prerequisites

macOS users need only the Xcode command-line tools, which bundle clang, clang++, and make. zlib is provided by the system.

```bash

# Install Xcode command-line tools

xcode-select --install

# Verify installation

gcc --version
clang --version
git --version

```

### Ubuntu and Debian Prerequisites

Install the complete build toolchain including the zlib development package:

```bash
sudo apt update
sudo apt install -y build-essential zlib1g-dev git

# Verify versions

gcc --version
g++ --version
git --version

```

### Windows Prerequisites via MSYS2

For Windows builds, use MSYS2 to provide a POSIX-compatible environment:

```powershell

# From an MSYS2 terminal after initial setup

pacman -Syuu
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-zlib git

# Verify tools

gcc --version
g++ --version
git --version

```

## Understanding the Build Process

Once prerequisites are installed, the repository's [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) handles the entire compilation. This script:

1. Invokes the C compiler to build sources from `internal/cbm/`
2. Links against SQLite and LZ4 using flags defined in `Makefile.cbm`
3. Outputs the final static binary to `build/c/codebase-memory-mcp`

For a standard build:

```bash
git clone https://github.com/DeusData/codebase-memory-mcp.git
cd codebase-memory-mcp
scripts/build.sh

```

To include the optional UI components (which require the C++ compiler):

```bash
scripts/build.sh --with-ui

```

If any prerequisite is missing, [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) fails with a descriptive error message indicating which tool or library was not found.

## Summary

- **Pre-built route**: No prerequisites; the binary runs standalone with zero dependencies.
- **Source build route**: Requires `gcc`/`clang`, `g++`/`clang++`, `zlib` dev headers, and `git`.
- **Key build files**: [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) orchestrates the process using `Makefile.cbm`, targeting `build/c/codebase-memory-mcp` for output.
- **Platform differences**: macOS includes zlib by default; Linux requires explicit `zlib1g-dev` installation; Windows needs MSYS2.

## Frequently Asked Questions

### Do I need a C++ compiler if I am not building the UI?

Yes. While the core `codebase-memory-mcp` engine is pure C, the build system defined in [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) and `Makefile.cbm` still invokes the C++ compiler for certain helper components even in standard builds. The `--with-ui` flag specifically adds UI-related C++ components, but the base toolchain requirement remains.

### Can I install codebase-memory-mcp without administrative privileges?

Yes, if you use the pre-built binaries or install the development tools to a user-writable location (such as via Homebrew on macOS or custom prefix builds on Linux). The [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) wrapper produces a static binary at `build/c/codebase-memory-mcp` that requires no system-wide installation.

### What specific compiler versions are supported?

The project compiles with standard C11 and C++17 support. Any recent version of GCC (7+) or Clang (6+) is sufficient. The [`build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/build.sh) script checks for compiler presence but generally accepts any modern toolchain that ships with `build-essential` on Ubuntu or Xcode Command Line Tools on macOS.

### Where does the installation script place the final binary?

When building from source, [`scripts/build.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/scripts/build.sh) places the executable at `build/c/codebase-memory-mcp` relative to the repository root. The user-friendly [`install.sh`](https://github.com/DeusData/codebase-memory-mcp/blob/main/install.sh) (Unix) and `install.ps1` (Windows) scripts automate downloading pre-built versions and placing them in system PATH directories, but manual builds remain in the build directory until you move them.