# MacOS に Unsloth をインストール

ローカルのApple MacOSデバイスにUnslothをインストールするには、以下の手順に従ってください:

### Unslothをインストール

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

更新または使用するには同じコマンドを使います `unsloth studio update`.

### 起動

再びUnslothを起動したいときは毎回:

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

Unsloth Studioの詳細なインストール手順と要件については、 [ガイドをご覧ください](https://unsloth.ai/docs/jp/xin-zhe/studio/install).

### アンインストール

macOsでUnsloth Studioをアンインストールするには、次の4つの手順に従ってください:

#### **1. アプリケーションを削除する**

* MacOS, Linux: `rm -rf ~/.unsloth/studio/unsloth ~/.unsloth/studio/studio`

これによりアプリケーションは削除されますが、モデルのチェックポイント、エクスポート、履歴、キャッシュ、チャットはそのまま保持されます。

#### **2. ショートカットとシンボリックリンクを削除する**

**macOS:**

```bash
rm -rf ~/Applications/Unsloth\ Studio.app ~/Desktop/Unsloth\ Studio
```

#### **3. CLIコマンドを削除する**

**macOS, Linux:**

```bash
rm -f ~/.local/bin/unsloth
```

#### **4. すべて削除する（オプション）**

履歴、キャッシュ、チャット、モデルのチェックポイント、モデルのエクスポートも削除するには、Unslothフォルダ全体を削除してください:

* MacOS, Linux: `rm -rf ~/.unsloth`

ダウンロードしたHFモデルファイルはHugging Faceのキャッシュに別途保存されることに注意してください。上記の手順ではそれらは削除されません。ディスク容量を回収したい場合は、以下を参照してください。 **モデルファイルの削除** 下記を参照してください。

{% hint style="warning" %}
注意:  `rm -rf` コマンドを使用すると、 **すべてが削除されます**。履歴、キャッシュ、チャットなども含まれます。
{% endhint %}

それでもUnslothで依存関係の問題が発生する場合、多くのユーザーはUnslothを強制的にアンインストールして再インストールすることで解決しています:

{% code overflow="wrap" %}

```bash
pip install --upgrade --force-reinstall --no-cache-dir --no-deps unsloth
pip install --upgrade --force-reinstall --no-cache-dir --no-deps unsloth_zoo
```

{% endcode %}

### **モデルファイルの削除**

モデル検索のゴミ箱アイコンから古いモデルファイルを削除するか、Hugging Faceのキャッシュディレクトリから該当するキャッシュ済みモデルフォルダを削除できます。

デフォルトのキャッシュ場所は次のとおりです:

{% code expandable="true" %}

```bash
~/.cache/huggingface/hub/
```

{% endcode %}

もし `HF_HUB_CACHE` または `HF_HOME` が設定されている場合は、その場所を代わりに使用してください。LinuxおよびWSLでは、 `XDG_CACHE_HOME` でもデフォルトのキャッシュルートを変更できます。次のコマンドで確認できます:

{% code expandable="true" %}

```bash
echo ${HF_HUB_CACHE:-${HF_HOME:-${XDG_CACHE_HOME:-$HOME/.cache}/huggingface}/hub}
```

{% endcode %}

特定のモデルを削除するには、そのフォルダ（例: `models--unsloth--Llama-3.1-8B-bnb-4bit`）をキャッシュディレクトリから削除してください。キャッシュされたモデルをすべて削除するには:

{% code expandable="true" %}

```bash
rm -rf ~/.cache/huggingface/hub/
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://unsloth.ai/docs/jp/meru/install/mac.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
