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

# タスクをローカルで実行

> Octoparse CLIでローカル実行を開始し、イベントのストリーム、デタッチ実行、制御、履歴確認、データ出力を行います。

`octoparse run` は組み込みOctoparseエンジンでローカル抽出を開始します。デスクトップアプリは不要です。

## フォアグラウンドで実行する

```bash theme={null}
octoparse run <taskId>
octoparse run <taskId> --max-rows 100
octoparse run <taskId> --timeout-ms 600000
octoparse run <taskId> --headless
```

リモートタスクを取得せずローカル定義を使用できます。

```bash theme={null}
octoparse run local-task --task-file task.json
```

ローカルタスクファイルの実行を含め、機能コマンドには認証情報が必要です。

## ブラウザを選択する

```bash theme={null}
octoparse run <taskId> --browser independent --headless
octoparse run <taskId> --browser user --browser-id chrome --profile "Default"
```

設定方法は[ブラウザモードを選択](browser-modes)を参照してください。

## イベントをストリームする

```bash theme={null}
octoparse run <taskId> --json
octoparse run <taskId> --jsonl
```

`--jsonl` は行、ログ、CAPTCHA、プロキシ、ダウンロード、ライフサイクルイベントを出力します。詳細は[出力と終了コード](../reference/output-and-exit-codes)を参照してください。

## デタッチして実行する

```bash theme={null}
octoparse run <taskId> --detach --output ./runs
```

履歴確認やエクスポートでも同じ `--output` ディレクトリを指定します。

## ローカル実行を制御する

```bash theme={null}
octoparse local status <taskId> --output ./runs
octoparse local pause <taskId>
octoparse local resume <taskId>
octoparse local stop <taskId>
octoparse local history <taskId> --output ./runs --json
octoparse local cleanup --json
```

ローカル状態はこのCLIのみで追跡され、デスクトップアプリとは同期されません。

## ローカル結果を出力する

統一されたdataコマンドを推奨します。

```bash theme={null}
octoparse data export <taskId> --source local --output ./runs --format xlsx
octoparse data export <taskId> --source local --lot-id <lotId> --format csv
```

`octoparse local export` は互換性のため引き続き利用できます。

<Note>
  `runs` コマンドグループは内部アーティファクト確認用です。通常はtask IDと `local`・`data`、またはlot IDと `data export` を使用してください。
</Note>
