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

# 新使用者終端機指南

> 針對首次使用終端機的使用者在 macOS 和 Windows 上安裝 Claude Code 的逐步指南。

即使您從未使用過終端機，也可以使用 Claude Code。本指南將引導您開啟終端機、安裝 Claude Code 以及進行首次互動。

* [macOS 和 Linux](#macos-and-linux)
* [Windows](#windows)

<Note>
  不想使用終端機？Claude Code 桌面應用程式可讓您完全跳過終端機。下載 [macOS](https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect?utm_source=claude_code\&utm_medium=docs) 或 [Windows](https://claude.com/download?utm_source=claude_code\&utm_medium=docs) 版本，然後查看[桌面快速入門](/docs/zh-TW/desktop-quickstart)以開始使用。在 Linux 上，請按照 [Linux 安裝說明](/docs/zh-TW/desktop-linux)使用 apt 安裝應用程式。
</Note>

<h2 id="macos-and-linux">
  macOS 和 Linux
</h2>

按照以下步驟從 macOS 或 Linux 終端機安裝並啟動 Claude Code。Claude Code 需要 macOS 13.0 或更新版本。請查看[系統需求](/docs/zh-TW/setup#system-requirements)以了解支援的 Linux 發行版。

<Steps>
  <Step title="開啟終端機">
    **macOS**：按 `Cmd + Space` 開啟 Spotlight 搜尋，輸入 `Terminal`，然後按 `Enter`。

    **Linux**：開啟您的終端機應用程式。在大多數發行版上，按 `Ctrl + Alt + T` 或在應用程式選單中搜尋'Terminal'。

    一個視窗將出現，顯示閃爍的游標。這就是您的終端機，您可以在此輸入命令。
  </Step>

  <Step title="安裝 Claude Code">
    複製此行，將其貼到您的終端機中（macOS 上按 `Cmd + V`，Linux 上按 `Ctrl + Shift + V`），然後按 `Enter`：

    ```bash theme={null}
    curl -fsSL https://claude.ai/install.sh | bash
    ```

    這會從 claude.ai 下載並執行 Claude Code 安裝程式。您會看到文字滾動。完成後，您會看到「Claude Code successfully installed!」訊息。如果您看到錯誤，請查看下方的[疑難排解部分](#macos-and-linux-troubleshooting)。
  </Step>

  <Step title="啟動 Claude Code">
    輸入 `claude` 並按 `Enter`：

    ```bash theme={null}
    claude
    ```

    系統會提示您使用 Claude 帳戶[登入](/docs/zh-TW/authentication)。按照螢幕上的指示進行。瀏覽器視窗將開啟供您登入。
  </Step>

  <Step title="開始使用 Claude Code">
    登入後，您可以開始詢問 Claude 有關您的程式碼或任何其他事項的問題。Claude Code 完全以文字形式執行。您輸入訊息並按 `Enter` 發送。以下是一些需要了解的事項：

    * 您無法在終端機中點擊任何內容。使用箭頭鍵移動。
    * 按 `Esc` 中斷 Claude（如果它正在執行）。
    * 輸入 `exit` 或按 `Ctrl + D` 以離開 Claude Code。
    * 輸入 `/help` 以查看可用命令。
  </Step>
</Steps>

***

<h2 id="windows">
  Windows
</h2>

按照以下步驟在 Windows 上選擇性地安裝 Git for Windows、設定 PowerShell 並啟動 Claude Code。Claude Code 需要 Windows 10 版本 1809 或更新版本。請查看[系統需求](/docs/zh-TW/setup#system-requirements)以了解完整詳細資訊。

<Steps>
  <Step title="安裝 Git for Windows（選擇性）">
    Git for Windows 提供 Git Bash，可啟用 Bash 工具。沒有它，Claude Code 會改用 PowerShell。您不需要自己學習 Git。

    如果您還沒有安裝：

    1. 前往 [git-scm.com/downloads/win](https://git-scm.com/downloads/win) 並下載安裝程式
    2. 執行安裝程式。在每個畫面上點擊 Next 以接受預設值。安裝程式有許多畫面，但您不需要變更任何內容。
    3. 如果它要求您選擇編輯器，保持預設值並點擊 Next。
    4. 當您看到'Adjusting your PATH environment'時，保持建議的選項被選中。

    <Note>
      已經有 Git？您可以跳過此步驟。如果您不確定，無論如何安裝它。重新安裝不會造成問題。
    </Note>
  </Step>

  <Step title="開啟 PowerShell">
    PowerShell 是 Windows 內建的終端機，用於輸入命令。它預先安裝在每台 Windows 電腦上。

    按 `Win + X` 並從選單中選擇 **Windows PowerShell**（或 **Terminal**）。一個帶有閃爍游標的視窗將出現。這是您輸入命令的地方。

    <Note>
      Windows 有兩個命令列程式：PowerShell 和 CMD。它們看起來相似但使用不同的命令。確保您在 PowerShell 中進行下一步。

      判斷您在哪一個的方法：

      * **PowerShell**：在每行的開始顯示 `PS C:\Users\YourName>`
      * **CMD**：顯示 `C:\Users\YourName>`，沒有 `PS`
    </Note>
  </Step>

  <Step title="安裝 Claude Code">
    複製此行，使用 `Ctrl + V` 或右鍵點擊將其貼到 PowerShell 中，然後按 `Enter`：

    ```powershell theme={null}
    irm https://claude.ai/install.ps1 | iex
    ```

    這會下載並執行 Claude Code 安裝程式。`irm` 會擷取檔案，`iex` 會執行它。您會看到文字滾動。完成後，您會看到'Claude Code successfully installed!'訊息。如果您看到錯誤，請查看下方的[疑難排解部分](#windows-troubleshooting)。

    <Note>
      如果您在 CMD 而不是 PowerShell 中，請使用此命令：

      ```batch theme={null}
      curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
      ```
    </Note>
  </Step>

  <Step title="啟動 Claude Code">
    執行 `claude`。如果 PowerShell 顯示 `'claude' is not recognized`，安裝目錄還不在您的 PATH 上。按照下方的 ['claude is not recognized'](#windows-troubleshooting) 修復，然後開啟新的 PowerShell 視窗並再試一次。

    ```powershell theme={null}
    claude
    ```

    系統會提示您使用 Claude 帳戶[登入](/docs/zh-TW/authentication)。按照螢幕上的指示進行。瀏覽器視窗將開啟供您登入。
  </Step>

  <Step title="開始使用 Claude Code">
    登入後，您可以開始詢問 Claude 有關您的程式碼或任何其他事項的問題。Claude Code 完全以文字形式執行。您輸入訊息並按 `Enter` 發送。以下是一些需要了解的事項：

    * 您無法在終端機中點擊任何內容。使用箭頭鍵移動。
    * 按 `Esc` 中斷 Claude（如果它正在執行）。
    * 輸入 `exit` 或按 `Ctrl + D` 以離開 Claude Code。
    * 輸入 `/help` 以查看可用命令。
  </Step>
</Steps>

***

<h2 id="what’s-next">
  接下來呢？
</h2>

一旦您看到 Claude Code 歡迎畫面，您就可以開始了。您不需要知道如何編寫程式碼。用簡單的英文描述您想要的內容，Claude 會為您編寫程式碼。

<h3 id="build-something">
  建立一些東西
</h3>

Claude 可以根據描述建立專案：

```text theme={null}
make me a simple webpage that says hello world
```

Claude 為您建立檔案。雙擊 HTML 檔案以在瀏覽器中開啟它。

<h3 id="work-with-files-on-your-computer">
  使用電腦上的檔案
</h3>

Claude 可以讀取和組織您已有的檔案：

```text theme={null}
look at the screenshots on my Desktop and rename them based on what's in each image
```

<h3 id="ask-questions">
  提出問題
</h3>

Claude 可以解釋事物、幫助您學習或規劃專案：

```text theme={null}
I want to build a personal budget tracker. What would I need?
```

如果您還沒有專案，沒關係。Claude 可以幫助您開始一個新專案。

<h3 id="other-ways-to-use-claude-code">
  使用 Claude Code 的其他方式
</h3>

您不必使用終端機。Claude Code 也可在以下位置使用：

* [VS Code](/docs/zh-TW/vs-code) 和 [JetBrains IDE](/docs/zh-TW/jetbrains) 作為編輯器擴充功能
* [桌面應用程式](/docs/zh-TW/desktop-quickstart)，無需終端機
* [網頁](/docs/zh-TW/claude-code-on-the-web)上的 claude.ai/code 用於遠端工作階段
* [GitHub Actions](/docs/zh-TW/github-actions) 和 [GitLab CI/CD](/docs/zh-TW/gitlab-ci-cd) 用於自動化

<h3 id="learn-more">
  深入了解
</h3>

* [快速入門](/docs/zh-TW/quickstart)：Claude Code 首個專案的引導式逐步解說
* [Claude Code 如何運作](/docs/zh-TW/how-claude-code-works)：了解 Claude 如何讀取您的檔案、執行命令和進行編輯
* [最佳實踐](/docs/zh-TW/best-practices)：透過有效的提示和專案設定獲得更好的結果
* [常見工作流程](/docs/zh-TW/common-workflows)：除錯、測試、重構等的逐步指南
* [終端機設定](/docs/zh-TW/terminal-config)：自訂您的終端機以獲得最佳 Claude Code 體驗

***

<h2 id="troubleshooting">
  疑難排解
</h2>

<h3 id="macos-and-linux-troubleshooting">
  macOS 和 Linux 疑難排解
</h3>

如果您在 macOS 或 Linux 上安裝時遇到問題，請檢查這些常見問題：

<Accordion title="'command not found: claude'">
  如果在安裝後看到 `command not found: claude`，安裝程式放置 `claude` 的資料夾不在您的 PATH 中。安裝程式在安裝結束時的 `Setup notes` 下列印了確切的修復方法，所以請執行該命令，或使用下面適用於您的 shell 的命令。

  對於 Zsh，macOS 預設 shell：

  ```bash theme={null}
  echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
  source ~/.zshrc
  ```

  對於 Bash，Linux 預設 shell：

  ```bash theme={null}
  echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
  source ~/.bashrc
  ```

  然後開啟新的終端機並再試一次 `claude`。如果仍然找不到，請檢查檔案 `~/.local/bin/claude` 是否存在。如果不存在，表示安裝未完成。如需更多詳細資訊，請參閱[修復您的 PATH](/docs/zh-TW/troubleshoot-install#verify-your-path)。
</Accordion>

<Accordion title="HTML 程式碼錯誤或 'syntax error near unexpected token'">
  如果您看到 `bash: line 1: syntax error near unexpected token '<'` 或終端機中出現 HTML 程式碼（如 `<!DOCTYPE html>`），安裝 URL 傳回的是網頁而不是安裝程式指令碼。

  如果頁面顯示'App unavailable in region'，Claude Code 在您的國家/地區不可用。請參閱[支援的國家/地區](https://www.anthropic.com/supported-countries)。

  否則，請嘗試再次執行命令。如果持續發生，請改用 [Homebrew](https://brew.sh) 安裝：

  ```bash theme={null}
  brew install --cask claude-code
  ```
</Accordion>

<Accordion title="'dyld' 錯誤或 'built for Mac OS X 13.0'">
  如果您看到 `dyld: cannot load`、`dyld: Symbol not found` 或 `built for Mac OS X 13.0`，您的 macOS 版本可能比 Claude Code 支援的版本更舊。

  開啟 Apple 選單並選擇「About This Mac」以檢查您的版本。如果它比 13.0 更舊，請透過軟體更新更新 macOS。請參閱 [macOS 疑難排解指南](/docs/zh-TW/troubleshoot-install#dyld-cannot-load-on-macos)以了解更多詳細資訊。
</Accordion>

如需其他錯誤，請參閱完整的[安裝疑難排解指南](/docs/zh-TW/troubleshoot-install)。

<h3 id="windows-troubleshooting">
  Windows 疑難排解
</h3>

如果您在 Windows 上安裝時遇到問題，請檢查這些常見問題：

<Accordion title="'irm is not recognized'">
  您在 CMD 中，而不是 PowerShell。關閉此視窗並改為開啟 PowerShell（`Win + X` 然後選擇 Windows PowerShell）。

  或者，使用 CMD 安裝命令：

  ```batch theme={null}
  curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
  ```
</Accordion>

<Accordion title="SSL/TLS 錯誤或 'Could not create SSL/TLS secure channel'">
  這通常發生在較舊的 Windows 10 系統上。先執行此行，然後重試安裝：

  ```powershell theme={null}
  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  irm https://claude.ai/install.ps1 | iex
  ```
</Accordion>

<Accordion title="'Claude Code on Windows requires either Git for Windows (for bash) or PowerShell'">
  找不到 PowerShell 或 Git Bash。Claude Code 需要至少一個 shell。

  1. 確保 `powershell.exe` 在您的 `PATH` 上。其預設位置是 `C:\Windows\System32\WindowsPowerShell\v1.0\`。或者，安裝 [PowerShell 7](https://aka.ms/powershell)，它提供 `pwsh`。
  2. 如果您寧願使用 Git Bash，請安裝 [Git for Windows](https://git-scm.com/downloads/win)，按照 [Windows 部分的第一步](#windows)。
  3. 如果已安裝 Git 但 Claude Code 找不到它，請告訴它在哪裡查找：
     ```powershell theme={null}
     $env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"
     ```
     然後再次執行 `claude`。如果您的 Git 安裝在其他地方，請透過執行以下命令找到路徑：
     ```powershell theme={null}
     Get-Command git | Select-Object Source
     ```
     在該路徑中查找 `Git\bin` 資料夾並改用它。

  要使其永久化，以便您不必每次都設定它，請參閱[設定 Git Bash 路徑](/docs/zh-TW/troubleshoot-install#claude-code-on-windows-requires-either-git-for-windows-for-bash-or-powershell)。
</Accordion>

<Accordion title="'claude is not recognized'">
  此錯誤表示安裝目錄不在您的 PATH 中。在 PowerShell 中執行這些命令以新增它：

  ```powershell theme={null}
  $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
  [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
  ```

  關閉 PowerShell，開啟新視窗，然後再試一次 `claude`。請參閱[驗證您的 PATH](/docs/zh-TW/troubleshoot-install#verify-your-path)以了解更多詳細資訊。
</Accordion>

如需其他錯誤，請參閱完整的[安裝疑難排解指南](/docs/zh-TW/troubleshoot-install)。
