# 【 VScode】 加入class path

了解，你的意思是想讓 `code` 指令（用來從終端機開啟 VS Code）**在 Zsh 中可以使用**。這通常是因為 `code` 沒有被加入 PATH。以下是解法：

---

### ✅ macOS 上讓 `code` 指令可用（官方方式）

1. 打開 VS Code
2. 用快捷鍵 `Cmd + Shift + P` 打開 **Command Palette**
3. 輸入並選擇：
    
    ```
    Shell Command: Install 'code' command in PATH
    
    ```
4. 關閉終端機重新開啟，輸入：
    
    ```bash
    code --version
    
    ```
    
    若能顯示版本就成功了！

---

### ✅ 手動加入 `code` 到 PATH（若上面方式無效）

VS Code 的 `code` 通常在這裡：

```bash
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin

```

你可以將這段加入 `~/.zshrc`：

```zsh
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"

```

然後執行：

```bash
source ~/.zshrc

```

接著執行 `code` 應該就會有反應了。