> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/deployment/ja/self-hosted/inference-server/install/mac.md).

# Mac にインストール

ネイティブの Apple Silicon アプリ、Docker、または Docker 外での MPS アクセラレーションを使って macOS に Roboflow Inference Server をインストールします。

このページの Docker の例では、localhost のポート 9001 を公開します。別のマシン上のクライアントから接続する場合は、マッピングを意図的に到達可能なホストアドレスに変更し、次の設定を行ってください： [サーバーアクセス](https://docs.roboflow.com/deployment/ja/self-hosted/inference-server/configuration/security.md#restrict-network-access).

## macOS ネイティブアプリ（Apple シリコン）

ネイティブデスクトップアプリを使って、Apple シリコン搭載の Mac で Roboflow Inference Server を実行できます。最新の GitHub リリースから最新の DMG ディスクイメージをダウンロードしてください： [GitHub で最新リリースを確認してインストーラーをダウンロード](https://github.com/roboflow/inference/releases).

1. [Roboflow Inference の DMG をダウンロード](https://github.com/roboflow/inference/releases) ディスクイメージ。
2. ディスクイメージをダブルクリックしてマウントします。
3. Roboflow Inference アプリを「アプリケーション」フォルダにドラッグします。
4. 「アプリケーション」フォルダを開き、Roboflow Inference アプリをダブルクリックしてサーバーを起動します。

## Docker の使用

{% tabs %}
{% tab title="CPU" %}
まず、 [Docker Desktop をインストールし](https://docs.docker.com/desktop/setup/install/mac-install/)ます。次に、CLI を使ってコンテナを起動します：

```bash
pip install inference-cli
inference server start
```

コンテナ設定をより細かく制御したい場合は、手動で起動します：

```bash
sudo docker run -d \
    --name inference-server \
    --read-only \
    -p 127.0.0.1:9001:9001 \
    --volume ~/.inference/cache:/tmp:rw \
    --security-opt="no-new-privileges" \
    --cap-drop="ALL" \
    --cap-add="NET_BIND_SERVICE" \
    roboflow/roboflow-inference-server-cpu:latest
```

{% endtab %}

{% tab title="GPU（MPS）" %}
Apple は現時点で [Metal Performance Shaders（MPS）デバイスを Docker に渡すことをサポートしていない](https://github.com/pytorch/pytorch/issues/81224)ため、Mac ではコンテナ内でハードウェアアクセラレーションを利用できません。MPS を使用するには、Docker の外部でサーバーを実行する必要があります。

{% hint style="success" %}
まずは CPU 用の Docker イメージで始め、より高速な処理が必要になった場合に、後から MPS アクセラレーションを使って Docker の外部で実行する方法に切り替えるのが最も簡単です。
{% endhint %}

Mac で Python 環境を管理するには、 [`pyenv`](https://github.com/pyenv/pyenv) と [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv) の使用をおすすめします。特に、 [Homebrew](https://brew.sh) では Python 3.13 がデフォルトで使用されますが、Inference が使用する機械学習依存関係のいくつかは、まだ Python 3.13 に対応していないためです。

pyenv `pyenv` と `pyenv-virtualenv` をインストールして設定したら（シェルの設定に関する詳しい手順に従ってください）、Python 3.12 の `inference` 仮想環境を作成して有効化します：

```bash
pyenv install 3.12
pyenv virtualenv 3.12 inference
pyenv activate inference
```

Docker の外部でサーバーをインストールして実行するには、リポジトリをクローンし、依存関係をインストールして、 `cpu_http.py` リポジトリのルートディレクトリに配置し、次のコマンドでサーバーを起動します。 `uvicorn`:

```bash
git clone https://github.com/roboflow/inference.git
cd inference
pip install .
cp docker/config/cpu_http.py .
uvicorn cpu_http:app --port 9001 --host 0.0.0.0
```

サーバーが次のアドレスで起動しました。 `http://localhost:9001` MPSアクセラレーションを使用します。
{% endtab %}
{% endtabs %}

## 次のステップ

* [モデルを実行する](https://docs.roboflow.com/deployment/ja/self-hosted/self-hosted.md#run-model-locally) 新しいサーバーに対して。
* [ポート、キャッシュ、モデルの制限に関する](https://docs.roboflow.com/deployment/ja/self-hosted/inference-server/configuration/docker-configuration.md) Docker設定オプション。
* [セルフホストサーバーのセキュリティ保護](https://docs.roboflow.com/deployment/ja/self-hosted/inference-server/configuration/security.md) localhostの外部に公開する前に。
