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

# difyctl のインストール

> ワンライナースクリプトまたは手動でのバイナリダウンロードによる difyctl のインストール

`difyctl` はランタイム依存のない単体のバイナリです。インストールスクリプトがお使いのプラットフォームを検出し、Dify の GitHub Releases から対応するビルドをダウンロードして、チェックサムを検証し、バイナリを配置します。

> [!NOTE]
>
> `difyctl` の各ビルドは特定の Dify バージョンに対応しています。サーバーに合ったビルドをインストールしてください（後述の `DIFY_VERSION` を参照）。

## インストール

**1. インストーラーの実行**

`difyctl` のビルドは Dify の各リリースに同梱されています。Dify Enterprise 3.13.x は Dify `1.17.1` で動作するため、対応するビルドをインストールします：

> [tab] macOS / Linux
>
> サポートするプラットフォーム：macOS と Linux、x64 と arm64。
>
> ```bash theme={null}
> curl -fsSL https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install-cli.sh | DIFY_VERSION=1.17.1 sh
> ```
>
> スクリプトは `~/.local/bin/difyctl` にインストールし、そのディレクトリが `PATH` に含まれていない場合は通知します。

> [tab] Windows
>
> サポートするプラットフォーム：x64。
>
> ```powershell theme={null}
> $env:DIFY_VERSION = "1.17.1"
> irm https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install.ps1 | iex
> ```
>
> スクリプトは `%LOCALAPPDATA%\difyctl\bin\difyctl.exe` にインストールし、そのディレクトリがまだ `PATH` にない場合は、`PATH` に追加するコマンドを表示します。

> [tab] 手動ダウンロード
>
> 1. [Dify の GitHub Releases](https://github.com/langgenius/dify/releases) から、サーバーの Dify バージョンに合うリリースを選び、2 つのアセットをダウンロードします：
>
>    * お使いのプラットフォーム向けのバイナリ（`difyctl-v<version>-<os>-<arch>`）
>    * チェックサムマニフェスト（`difyctl-v<version>-checksums.txt`）
>
> 2. バイナリの SHA-256 ハッシュを計算し、checksums ファイル内の対応するエントリと比較します。
>
>    値が一致しない場合、ダウンロードは破損しているか改ざんされています。削除して再度ダウンロードしてください。
>
>    ```bash macOS / Linux theme={null}
>    shasum -a 256 difyctl-v<version>-<os>-<arch>
>    ```
>
>    ```powershell Windows theme={null}
>    Get-FileHash difyctl-v<version>-windows-x64.exe
>    ```
>
> 3. バイナリを `PATH` に配置します：
>
>    ```bash macOS / Linux theme={null}
>    chmod +x difyctl-v<version>-<os>-<arch>
>    mv difyctl-v<version>-<os>-<arch> ~/.local/bin/difyctl
>    ```
>
>    ```powershell Windows theme={null}
>    New-Item -ItemType Directory -Force "$env:LOCALAPPDATA\difyctl\bin" | Out-Null
>    Move-Item difyctl-v<version>-windows-x64.exe "$env:LOCALAPPDATA\difyctl\bin\difyctl.exe"
>    ```

> [!TIP]
>
> インストールをカスタマイズするには、インストールコマンドに次の環境変数を設定します。
>
> | 変数 | 説明 | 例 |
> | - | - | - |
> | `DIFY_VERSION` | `difyctl` を取得する Dify リリースタグ。[Dify Releases](https://github.com/langgenius/dify/releases) のタグと一致させる。 既定は最新リリース。サーバーが最新でない場合は、そのリリースタグを指定する。 | `1.17.1` |
> | `DIFYCTL_VERSION` | 特定の `difyctl` ビルドに固定する。`DIFY_VERSION` が未設定のときのみ使用される。 | `1.17.1` |
> | `DIFYCTL_PREFIX` | インストール先ディレクトリ（既定は `~/.local`）。バイナリは `<prefix>/bin` に配置される。 | `/usr/local` |
>
> 例：
>
> ```bash macOS / Linux theme={null}
> curl -fsSL https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install-cli.sh | DIFY_VERSION=1.17.1 sh
> ```
>
> ```powershell Windows theme={null}
> # PowerShell にインライン形式はなく、設定はそのセッションの間ずっと有効です
> $env:DIFY_VERSION = "1.17.1"
> irm https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install.ps1 | iex
> ```

**2. インストールの確認**

```bash theme={null}
difyctl version
```

バージョンとプラットフォームを含む `Client:` ブロックが表示されるはずです。

代わりに `command not found` が表示される場合、インストールディレクトリが `PATH` に含まれていません。次のように追加します：

```bash macOS / Linux theme={null}
# add to ~/.zshrc or ~/.bashrc; running it inline only lasts until the session ends
export PATH="$HOME/.local/bin:$PATH"
```

```powershell Windows theme={null}
[Environment]::SetEnvironmentVariable('PATH', "$env:LOCALAPPDATA\difyctl\bin;$env:PATH", 'User')
```

## アップデート

`difyctl` をアップデートするには、インストールスクリプトを再実行します。既存のバイナリがそのまま置き換わります。特定の Dify バージョンに切り替えるには、上記のとおり `DIFY_VERSION` を設定します。

## アンインストール

```bash macOS / Linux theme={null}
rm ~/.local/bin/difyctl
```

```powershell Windows theme={null}
Remove-Item -Recurse "$env:LOCALAPPDATA\difyctl"
```

アンインストール前にサインアウトするには、[`difyctl auth logout`](https://enterprise-docs.dify.ai/ja/3.13.x/develop/cli/reference/auth-and-contexts#サインアウト) を実行します。

## 次のステップ

`difyctl` をインストールしたら、`dify.example.com` へのサインイン方法に合ったパスを選びます：

> [card] [アカウントユーザー](https://enterprise-docs.dify.ai/ja/3.13.x/develop/cli/account-users/quick-start.md)
>
> Dify アカウントにサインインします。メールアドレスとパスワード、または所属組織の SSO を使用します。

> [card] [外部 SSO ユーザー](https://enterprise-docs.dify.ai/ja/3.13.x/develop/cli/sso-users/quick-start.md)
>
> Dify アカウントなし：外部 SSO 経由でサインインし、許可された特定のアプリを実行します。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.