# LibTmux.Server.stop/2

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/00d34b3d387da72a5a416f1dd3962a98c76cedd2/lib/libtmux/server.ex#L357
- **Page:** https://libtmux.org/en/elixir/latest/reference/libtmux-server-stop-2/

```
stop(server, options \\ [])
@spec stop(t(), [{:timeout, 1..600_000}]) ::
        :ok | {:error, LibTmux.Error.t()}
```

Stops a server that `start/1` created and removes its directory.

Sends [`kill-server`](/en/tmux/latest/manual/kill-server/), waits until the native helper proves that the daemon
has exited, and removes the directory. Stopping a server
that already stopped returns `:ok`. If the daemon still answers when
`:timeout` (5000 ms by default) ends, or the directory cannot be removed,
it returns `{:error, error}` and keeps the directory; call it again to
retry.

Returns `{:error, error}` with kind `:not_owned` for a Server that `new/1`
built or that another process started and already stopped.

## Parameters

- `server` (`t()`)
- `options` (`[{:timeout, 1..600_000}]`)
  Default: `[]`.

## Guides

Pages that discuss `stop/2`.

- [Getting started](/en/elixir/latest/guides/overview/)
