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
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.
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-mcpThen register:
$ claude mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen register:
$ claude mcp add tmux --scope user -- /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen register:
$ claude mcp add tmux --scope project -- /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen use this config:
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-mcpThen register:
$ codex mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen register:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
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-mcpThen register:
$ gemini mcp add --scope user tmux /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen register:
$ gemini mcp add --scope project tmux /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen use this config:
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-mcpThen use this config:
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-mcpThen register:
$ grok mcp add --scope user tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen register:
$ grok mcp add --scope project tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing 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-mcpThen use this config:
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-mcpThen register:
$ opencode mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing 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
Topics
Subject-by-subject, with Swift in every code block.
Guides
Task guides for Swift.
Examples
Complete programs, sourced from the code each port tests.
Concepts
The domain model every port shares.