# Swift

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

> libtmux for Swift, version latest.

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

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`

```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](https://libtmux.org/en/swift/latest/workspace/) `tmux-workspace`

The workspace package is separate from the core library.

```console
$ 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](https://libtmux.org/en/swift/latest/mcp/) `libtmux-mcp`

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

Build or install the server first:

```console
$ swift build --product libtmux-mcp
```

Then register:

```console
$ 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)`

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

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

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

[Task guides for Swift.](https://libtmux.org/en/swift/latest/guides/)

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

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

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

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

## Packages and integrations

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

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

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

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

## API references

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

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

[All Swift versions and install instructions](https://libtmux.org/en/swift/)
