---
title: grove env
description: Print the environment grove would give a command here, without running one, as shell exports for eval or as JSON for tools.
---

```sh
grove env [-s <name>] [--format shell|json]
```

Ports come from the leases that exist right now, so this reports rather than allocates: a variable naming a port nobody holds is left out, and named on stderr. Run the command under `grove exec`, or `grove hold`, to bring those into being.

```sh
eval "$(grove env)"
grove env --format json
```

The shell form is quoted for `eval`. The JSON form is an object of names to values, for tools.

## Flags

| Flag | Meaning |
|------|---------|
| `-s`, `--service` | The route or port to report on, overriding the directory. |
| `--format` | `shell` (default) or `json`. |
| `--socket` | The control socket to reach the daemon on. |
