# C++

Source: https://libtmux.org/en/cxx/latest/

> libtmux for C++, version latest.

![](https://libtmux.org/en/brand/cpp/library/logo.svg)

Drive a real tmux from C++.

libtmux-cxx

You are reading the **latest** documentation. Use the version control in the header to move between releases, or the port dropdown to find a corresponding page in another language.

## Install

### Library `libtmux-cxx`

```cmake
include(FetchContent)
FetchContent_Declare(
  libtmux
  GIT_REPOSITORY https://github.com/libtmux/libtmux-cxx.git
  GIT_TAG        v0.1.0-alpha.10
)
FetchContent_MakeAvailable(libtmux)
target_link_libraries(your_target PRIVATE libtmux::libtmux)
```

Name a tag or a commit, never a moving branch. Built this way the library brings nothing else: its tests, examples and MCP server all default off when it is not the top-level project.

### [Workspace Manager](https://libtmux.org/en/cxx/latest/workspace/) `tmux-workspace`

The workspace package is separate from the core library.

```console
$ cmake --preset cxx-dev -DLIBTMUX_BUILD_WORKSPACE_CLI=ON && \
    cmake --build --preset cxx-dev --target tmux-workspace --parallel 2
```

Run from a libtmux-cxx checkout with Clang 18.1.3, libc++ 18.1, CMake 3.25 or newer, and Ninja. The command is build/cxx-dev/apps/workspace/tmux-workspace.

### [MCP](https://libtmux.org/en/cxx/latest/mcp/) `libtmux-mcp-server`

Choose your client and configuration scope, then run the command or paste the configuration.

Build or install the server first:

```console
$ cmake -S . -B build/mcp -DLIBTMUX_BUILD_MCP_SERVER=ON -DLIBTMUX_FETCH_DEPS=ON && cmake --build build/mcp && cmake --install build/mcp --prefix ~/.local
```

Then register:

```console
$ claude mcp add tmux -- /absolute/path/to/libtmux-mcp-server
```

The MCP server is a build option rather than a second package, off by default because it is the only component that needs the JSON dependency. The install above puts libtmux-mcp-server in \~/.local/bin; use its full path.

Config file: `~/.claude.json (this project)`

### [Topics](https://libtmux.org/en/cxx/latest/topics/)

[Subject-by-subject, with C++ in every code block.](https://libtmux.org/en/cxx/latest/topics/)

### [Guides](https://libtmux.org/en/cxx/latest/guides/)

[Task guides for C++.](https://libtmux.org/en/cxx/latest/guides/)

### [Examples](https://libtmux.org/en/cxx/latest/examples/)

[Complete programs, sourced from the code each port tests.](https://libtmux.org/en/cxx/latest/examples/)

### [Concepts](https://libtmux.org/en/cxx/latest/concepts/)

[The domain model every port shares.](https://libtmux.org/en/cxx/latest/concepts/)

## Packages and integrations

### [Workspace Manager](https://libtmux.org/en/cxx/latest/workspace/)

[Build the CLI from source and load workspace files with tmux-workspace load.](https://libtmux.org/en/cxx/latest/workspace/)

### [MCP](https://libtmux.org/en/cxx/latest/mcp/)

[In development. Connect an MCP client to tmux tools and inspect the server API.](https://libtmux.org/en/cxx/latest/mcp/)

## API references

### [Official reference](https://libtmux.org/en/cxx/latest/reference/)

[C++ API signatures and documentation, with links to related guides and APIs in other languages.](https://libtmux.org/en/cxx/latest/reference/)

[All C++ versions and install instructions](https://libtmux.org/en/cxx/)
