# namedSocketRoot

- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** constant
- **Source:** https://github.com/libtmux/libtmux-swift/blob/f02a4668570e1cc5198c941413750e021f42c214/Tests/TmuxFixture/TmuxFixture.swift#L161
- **Page:** https://libtmux.org/reference/swift/namedsocketroot/

The directory a socket *name* resolves inside, when the run provides one.

tmux looks a name up in `TMUX_TMPDIR`, whose default is shared with every
other tmux on the machine — the other libtmux ports' included. A suite that
addressed servers by name without moving that directory would put its
sockets exactly where anything sweeping by prefix can reach them, which is
what this whole root exists to prevent.

So the directory is taken from the environment rather than set into it. The
obvious alternative — `setenv` from the fixture — writes to `environ` while
other cases are concurrently reading it to build a tmux environment, and
that is a data race whether or not it has bitten yet. Cases that address a
socket by path do not care either way, `-S` being absolute.

`CONTRIBUTING.md` and CI name the directory; ``namedSocketsAvailable`` is
what the suite checks so a run without one skips those cases rather than
scattering sockets.
