# 在 MacOS 上安装 Unsloth

要在本地 Apple macOS 设备上安装 Unsloth，请按照以下步骤操作：

### 安装 Unsloth

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

使用相同的命令进行更新或使用 `unsloth studio update`.

### 更新 Unsloth

```bash
unsloth studio update
```

### 启动

每次你想再次启动 Unsloth 时：

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

有关 Unsloth Studio 的详细安装说明和要求， [请查看我们的指南](/docs/zh/xin/studio/install.md).

### 卸载

要在 macOS 上卸载 Unsloth Studio，请按照以下 4 个步骤操作：

#### **1. 移除应用程序**

* macOS、Linux： `rm -rf ~/.unsloth/studio/unsloth_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 缓存中——上述步骤都不会将其删除。 **删除模型文件** 如果你想回收那部分磁盘空间，请参见下方。

你可以通过模型搜索中的垃圾桶图标删除旧模型文件，或者从 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 %}

**1. 移除应用程序**

macOS、WSL、Linux： `rm -rf ~/.unsloth/studio/unsloth ~/.unsloth/studio/studio`

这会移除应用程序，但会保留你的模型检查点、导出、历史记录、缓存和聊天内容。

**2. 移除快捷方式和符号链接**

**macOS：**

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

**Linux：**

```bash
rm -f ~/.local/share/applications/unsloth-studio.desktop ~/Desktop/unsloth-studio.desktop
```

**WSL：**

```bash
rm -f ~/Desktop/unsloth-studio.desktop
```

WSL 还会创建一个 Windows 快捷方式——打开 PowerShell 并运行：

```powershell
Remove-Item -Force "$HOME\Desktop\Unsloth Studio.lnk"
Remove-Item -Force "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Unsloth Studio.lnk"
```

**3. 移除 CLI 命令**

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

**4. 移除全部内容（可选）**

如果你还想删除历史记录、缓存、聊天内容、模型检查点和模型导出：

```
rm -rf ~/.unsloth
```

请注意，已下载的模型文件会单独存储在 Hugging Face 缓存中——上述步骤都不会将其删除。 **删除模型文件** 有关如何回收那部分磁盘空间，请参见下方。

### **删除模型文件**

你可以通过模型搜索中的垃圾桶图标删除旧模型文件，或者从 Hugging Face 缓存目录中移除相应的已缓存模型文件夹。

默认缓存位置是：

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

如果 `HF_HUB_CACHE` 或 `HF_HOME` 已设置，请改用该位置。在 Linux 和 WSL 上， `XDG_CACHE_HOME` 也可以更改默认缓存根目录。你可以通过以下命令查看：

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

要删除特定模型，请删除其文件夹（例如 `models--unsloth--Llama-3.1-8B-bnb-4bit`）从缓存目录中移除。要清除所有已缓存模型：

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


---

# 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/zh/kai-shi-shi-yong/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.
