> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanamobile.com/llms.txt
> Use this file to discover all available pages before exploring further.

# solana-mobile localnet

> Run a local Solana validator for emulators and devices.

export const FooterDisclaimer = () => {
  return <p className="not-prose mt-16 text-center text-xs text-gray-500 dark:text-gray-400">
      Code samples on this page are subject to the{" "}
      <a className="underline underline-offset-2" href="https://www.apache.org/licenses/LICENSE-2.0">
        Apache 2.0 license
      </a>
      .
    </p>;
};

Run a local Solana validator in a container and forward its ports to connected devices and emulators, so apps on the device can reach `localhost:8899` as if the validator ran on the device itself.

## Shared options

These options apply to `start`, `check`, `forward`, `status`, and `stop`:

| Option                 | Description                                      |
| ---------------------- | ------------------------------------------------ |
| `--device <serial>`    | Target a device serial (repeatable)              |
| `--engine <engine>`    | Validator engine: `surfpool` or `test-validator` |
| `--port <port>`        | Host port for the RPC endpoint                   |
| `--studio-port <port>` | Host port for the Studio UI                      |
| `--ws-port <port>`     | Host port for the WebSocket endpoint             |

## localnet start

Start the validator and forward its ports to every connected device:

<CodeGroup>
  ```bash npm theme={null}
  npx solana-mobile@latest localnet start
  ```

  ```bash pnpm theme={null}
  pnpm dlx solana-mobile@latest localnet start
  ```

  ```bash bun theme={null}
  bunx solana-mobile@latest localnet start
  ```
</CodeGroup>

| Option            | Description                                       |
| ----------------- | ------------------------------------------------- |
| `--detach`        | Leave the validator running in the background     |
| `--image <image>` | Container image to run                            |
| `--no-watch`      | Do not re-apply port forwards when devices change |

## localnet check

Verify the validator is reachable from every device:

<CodeGroup>
  ```bash npm theme={null}
  npx solana-mobile@latest localnet check
  ```

  ```bash pnpm theme={null}
  pnpm dlx solana-mobile@latest localnet check
  ```

  ```bash bun theme={null}
  bunx solana-mobile@latest localnet check
  ```
</CodeGroup>

| Option   | Description                                   |
| -------- | --------------------------------------------- |
| `--json` | Print a stable JSON report                    |
| `--open` | Also open the Studio UI in the device browser |

## localnet forward

Forward validator ports to connected devices — useful after plugging in a new device:

<CodeGroup>
  ```bash npm theme={null}
  npx solana-mobile@latest localnet forward
  ```

  ```bash pnpm theme={null}
  pnpm dlx solana-mobile@latest localnet forward
  ```

  ```bash bun theme={null}
  bunx solana-mobile@latest localnet forward
  ```
</CodeGroup>

| Option    | Description                                        |
| --------- | -------------------------------------------------- |
| `--watch` | Keep re-applying port forwards when devices change |

## localnet logs

Print validator logs:

<CodeGroup>
  ```bash npm theme={null}
  npx solana-mobile@latest localnet logs
  ```

  ```bash pnpm theme={null}
  pnpm dlx solana-mobile@latest localnet logs
  ```

  ```bash bun theme={null}
  bunx solana-mobile@latest localnet logs
  ```
</CodeGroup>

| Option            | Description              |
| ----------------- | ------------------------ |
| `--lines <count>` | Number of lines to print |

## localnet status

Show validator and port forward status:

<CodeGroup>
  ```bash npm theme={null}
  npx solana-mobile@latest localnet status
  ```

  ```bash pnpm theme={null}
  pnpm dlx solana-mobile@latest localnet status
  ```

  ```bash bun theme={null}
  bunx solana-mobile@latest localnet status
  ```
</CodeGroup>

| Option   | Description                |
| -------- | -------------------------- |
| `--json` | Print a stable JSON report |

## localnet stop

Stop the validator and remove its port forwards:

<CodeGroup>
  ```bash npm theme={null}
  npx solana-mobile@latest localnet stop
  ```

  ```bash pnpm theme={null}
  pnpm dlx solana-mobile@latest localnet stop
  ```

  ```bash bun theme={null}
  bunx solana-mobile@latest localnet stop
  ```
</CodeGroup>

<FooterDisclaimer />
