# LibTmux.from_env

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Julia
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/server.jl#L65
- **Page:** https://libtmux.org/en/julia/latest/reference/libtmux-from_env/

```
from_env(; env, socket_path, socket_name, tmux)
```

## Methods

Read the endpoint from `TMUX`, or select the named `default` socket when it is absent. Explicit selectors take precedence. Return a [`Server`](/en/julia/latest/reference/libtmux-server/) description without contacting tmux or starting a daemon.

```julia
from_env(; env=ENV, socket_path=nothing, socket_name=nothing, tmux="tmux")
```



# See also

[`Server`](/en/julia/latest/reference/libtmux-server/) and [`snapshot`](/en/julia/latest/reference/libtmux-snapshot-1gv6/).

## Parameters

- `env`: Mapping used to read `TMUX`. The value must contain a socket path, process ID, and session index separated by commas. An absent or empty value selects the named `default` socket; a malformed value raises `ArgumentError`. Explicit socket selectors bypass this lookup.
  Default: `ENV`.
- `socket_path`: Path to a tmux socket. When supplied, select this endpoint instead of reading `env`; relative paths become absolute against the current directory. Supply either `socket_path` or `socket_name`, never both. An empty path or a path containing NUL raises `ArgumentError`.
  Default: `nothing`.
- `socket_name`: Name of a tmux socket, used as tmux's `-L` selector. When supplied, select this endpoint instead of reading `env`. The name must be nonempty and contain neither a slash nor NUL. Supply either `socket_name` or `socket_path`, never both.
  Default: `nothing`.
- `tmux`: Executable name or path for later operations on the returned server. A bare name is resolved through `PATH` when an operation runs. This call checks that the value is a nonempty string without NUL; it does not check whether the executable or socket exists.
  Default: `"tmux"`.
