Core LibraryalphaHome

Choose documentation 3

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Swift

Drive a real tmux from Swift.

libtmux-swift

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-swift

.package(
    url: "https://github.com/libtmux/libtmux-swift.git",
    exact: "0.1.0-alpha.5"
)

An exact version, not a range. Every tag before 0.1.0 is a prerelease: SwiftPM keeps prereleases out of a `from: "0.1.0"` range, and `from: "0.1.0-alpha.5"` resolves forward into every prerelease after it.

Workspace Manager tmux-workspace

The workspace package is separate from the core library.

$ swift build \
    --jobs 2 \
    --traits YAMLWorkspaces \
    --force-resolved-versions \
    --product tmux-workspace

Run from a libtmux-swift checkout with Swift 6.2 or newer on Linux, or Xcode Swift 6.3 or newer on macOS. The command is .build/debug/tmux-workspace.

MCP libtmux-mcp

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

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ claude mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

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

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ claude mcp add tmux --scope user -- /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ~/.claude.json (all projects)

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ claude mcp add tmux --scope project -- /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: .mcp.json (in repo, version-controlled)

Build or install the server first:

$ swift build --product libtmux-mcp

Then use this config:

{
    "mcpServers": {
        "tmux": {
            "command": "/absolute/path/to/.build/debug/libtmux-mcp"
        }
    }
}

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: claude_desktop_config.json

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ codex mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ~/.codex/config.toml

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

[mcp_servers.tmux]
command = "/absolute/path/to/.build/debug/libtmux-mcp"

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: .codex/config.toml (in repo)

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ gemini mcp add --scope user tmux /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ~/.gemini/settings.json

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ gemini mcp add --scope project tmux /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: .gemini/settings.json (in repo)

Build or install the server first:

$ swift build --product libtmux-mcp

Then use this config:

{
    "mcpServers": {
        "tmux": {
            "command": "/absolute/path/to/.build/debug/libtmux-mcp"
        }
    }
}

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: .cursor/mcp.json (in repo)

Build or install the server first:

$ swift build --product libtmux-mcp

Then use this config:

{
    "mcpServers": {
        "tmux": {
            "command": "/absolute/path/to/.build/debug/libtmux-mcp"
        }
    }
}

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ~/.cursor/mcp.json

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ grok mcp add --scope user tmux -- /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ~/.grok/config.toml

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ grok mcp add --scope project tmux -- /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ./.grok/config.toml (in repo)

Build or install the server first:

$ swift build --product libtmux-mcp

Then use this config:

{
    "mcpServers": {
        "tmux": {
            "command": "/absolute/path/to/.build/debug/libtmux-mcp"
        }
    }
}

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ~/.gemini/config/mcp_config.json

Build or install the server first:

$ swift build --product libtmux-mcp

Then register:

$ opencode mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcp

Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.

Config file: ~/.config/opencode/opencode.jsonc

Packages and integrations

API references

All Swift versions and install instructions

Esc

Type to search.

Reference preview Open reference