# session.settings.Session.set_environment

- **Module:** session.settings.Session
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/session/settings.rs#L308
- **Page:** https://libtmux.org/reference/rs/session-settings-session-set_environment/

```
session.settings.Session.set_environment(self, name: &str, value: impl Into<OsString>) -> Result<(), Error>
```

Set an environment variable for processes this session starts.

Existing panes keep the environment they were started with; this
affects what new panes inherit.

The value is marked sensitive, since an environment carries tokens.

# Errors

Returns an error when tmux rejects the name or value.
