# tmux_command:source_file/2

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_command.erl#L228
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_command-source_file-2/

```
source_file(Source, Options)
-spec source_file(source(), source_options()) ->
                     {ok, t()} | {error, map()}.
```

Build configuration loading from stdin or one literal absolute path, without I/O. `stdin` renders [`source-file -`](/en/tmux/latest/manual/source-file/); supply configuration bytes in the `stdin` option of `tmux_server:command/3` or `tmux_operation:start/3`. Those APIs bound input to 256 KiB including their argument reservation.

Paths are NUL-free POSIX byte binaries. Glob metacharacters and backslashes
are escaped so only that filename is selected; format expansion is disabled.
The combined encoded path and flags must fit `raw/2` limits. The file is read
by tmux at execution time; this builder does not open it or bound its size.

`parse_only` requests native `-n` parsing without executing the configuration's
command list. `quiet` requests native `-q` missing-file suppression; it does
not suppress syntax or execution errors. Both default to false. Configuration
is trusted tmux code, with its own variable, directive and command semantics.
Parse-only is not a sandbox. Execution can partially change server state before
an error; cancellation cannot undo those effects. Completion does not prove
that background jobs launched by the configuration have finished.

## Examples

```erlang
1> {ok, Source} = tmux_command:source_file(stdin, #{parse_only => true}), ok.
ok
2> tmux_command:argv(Source).
[<<"source-file">>,<<"-n">>,<<"--">>,<<"-">>]
```

## Parameters

- `Source` (`source()`)
- `Options` (`source_options()`)

## Guides

Pages that discuss `source_file/2`.

- [Native API documentation](/en/erlang/latest/guides/api-documentation/)
- [Apply configuration and await its completion signal](/en/erlang/latest/guides/configuration/)

## In other ports

Load a tmux configuration file

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Server.source_file`](/en/py/latest/reference/libtmux-server-source_file/) (method) |
| Ruby | [`LibTmux::Server#source_file`](/en/ruby/latest/reference/libtmux-server-source_file/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`server.Server.sourceFile`](/en/ts/latest/reference/server-server-sourcefile/) (method) |
| Rust | [`server.Server.source_file`](/en/rs/latest/reference/server-server-source_file/) (method) |
| Go | [`tmux.Server.SourceFile`](/en/go/latest/reference/tmux-server-sourcefile/) (method) |
| Java | [`io.github.libtmux.Server.sourceFile`](/en/java/latest/reference/io-github-libtmux-server-server-sourcefile/) (method) |
| C# | [`LibTmux.Server.SourceFileAsync`](/en/csharp/latest/reference/libtmux-server-sourcefileasync/) (method) |
| C++ | [`libtmux::Server::source_file`](/en/cxx/latest/reference/libtmux-server-source_file/) (method) |
| Swift | [`Server.sourceFile(_:)`](/en/swift/latest/reference/server-sourcefile(_-)/) (method) |
| OCaml | No direct public OCaml equivalent is recorded for this operation. |
| Perl | No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands. |

No equivalent is recorded in Lua, PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.
