# Install

URL: https://swb.one/docs/install

SwB runs on Linux, macOS and Windows. To build SwB from source, follow [Docker Compose](/docs/self-hosting#docker-compose). Use the methods below after package or image publication.

## Install and start [#install-and-start]

Use an empty folder for your SwB files. The owner key lets the `swb` command sign in as you.

<Tabs items={['uvx', 'pipx', 'Docker']}>
  <Tab value="uvx">
    [Install uv](https://docs.astral.sh/uv/getting-started/installation/). SwB needs Python 3.12 or later.

    ```bash
    uvx swb-one up
    ```

    uvx downloads and starts SwB. Open the one-time sign-in link from your terminal within five minutes. In the other examples, replace the leading `swb` with `uvx swb-one`.
  </Tab>
  <Tab value="pipx">
    [Install pipx](https://pipx.pypa.io/stable/how-to/install-pipx.html). SwB needs Python 3.12 or later.

    ```bash
    pipx install swb-one
    swb up
    ```

    pipx installs the `swb` command for your user account. Open the one-time sign-in link from your terminal within five minutes.

    If pipx uses an older Python, use `pipx install --python 3.12 swb-one`.
  </Tab>
  <Tab value="Docker">
    [Install Docker](https://docs.docker.com/get-started/get-docker/).

    ```bash
    (umask 077; set -C; printf 'SWB_KEY_OWNER=%s\nSWB_PUBLIC_URL=http://localhost:8870\n' "$(openssl rand -hex 32)" > .env)
    docker run -d --name swb --env-file .env \
      -p 127.0.0.1:8870:8000 -v swb-data:/data \
      ghcr.io/zhehanzhang/swb:latest
    ```

    These commands create a private `.env` file and start the container. The image keeps its data in `/data`. Run `docker exec swb swb login-link` to get a sign-in link. To run another SwB command inside the container, start it with `docker exec -it swb swb`.
  </Tab>
</Tabs>

On the first local start, `swb up` creates `.env`, `config/switchboard.yaml` and `data/` in the instance folder. Run `swb login-link` later to get a new link.

To create the files before you start the server, run `swb init`. Then run `swb up`. Run `swb login-link` in a second terminal from the same folder.

`swb up` listens on `127.0.0.1` at port `8870` by default. The default local MCP address is `http://localhost:8870/mcp`. Set `SWB_PORT` in the shell or in `.env` to use a different port.

Use `swb up --dir ./my-swb` to select an instance folder. Use the same `--dir` with `swb init`, `swb status`, `swb login-link`, `swb connect` and `swb claim`. See [Config](/docs/config) for bind addresses, config files and data folders.

## Check the server [#check-the-server]

```bash
curl -fsS http://127.0.0.1:8870/healthz
```

This signed-out request shows `status` and `version`. Run `swb status` or call `/healthz` with the owner key to list blocks, their states and any missing variables.

For a public SwB server, use its HTTPS address.

```bash
curl -fsS https://swb.example.com/healthz
```

## Server commands [#server-commands]

Run `swb --help` to see the command groups. Add `--help` to a command to see its options.

| Command | Use |
| - | - |
| `swb init` | Write a private owner key and a minimal config. |
| `swb up` | Start SwB on this computer. |
| `swb connect PLATFORM` | Get the steps to connect a platform. |
| `swb companion` | Pair, run or disconnect a companion. |
| `swb hook HARNESS` | Forward a local agent event to the companion. |
| `swb status` | Show the status and next steps. |
| `swb login-link` | Create a one-time owner sign-in link. |
| `swb claim` | Save a credential from a claim link or code. |
| `swb serve` | Run the server with its configured host and port. |
| `swb export DIR` | Write saved memory to Markdown files in the output folder `DIR`. |
| `swb log [--limit N]` | Print recent audit entries. The default limit is `50`. |
| `swb config migrate` | Print a version 1 config in the version 2 format. |
| `swb blocks list` | List the configured blocks. |
| `swb blocks show BLOCK` | Show the settings for a block. |
| `swb blocks check` | Check the block configuration. |
| `swb targets` | List the targets for `send`. |

## Versions [#versions]

After publication, PyPI hosts the `swb-one` package. GitHub Container Registry hosts the `ghcr.io/zhehanzhang/swb` image. To select one release, use a version such as `1.0.0`. The image tag `latest` follows the newest stable release.
