ClawTank
使用說明小技巧部落格立即部署
所有文章
如何完全重設 OpenClaw:恢復原廠、設定重設與全新開始 [2026]

如何完全重設 OpenClaw:恢復原廠、設定重設與全新開始 [2026]

2026年3月1日|4 分鐘閱讀
目錄
  • 你需要哪種重設?
  • 設定重設
  • 重設 AI 模型
  • 重設裝置
  • 重設記憶
  • 重設 Gateway Token
  • 完全恢復原廠設定
  • 原生安裝
  • Docker 容器
  • Docker Compose
  • 全新重裝
  • 步驟一:移除所有東西
  • 步驟二:重新安裝
  • 步驟三:設定
  • 在 Docker 內重設而不重建容器
  • 任何重設之後
  • 完全避免重設

還沒安裝 OpenClaw 嗎?

curl -fsSL https://openclaw.ai/install.sh | bash
iwr -useb https://openclaw.ai/install.ps1 | iex
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

怕影響自己的電腦?ClawTank 60 秒雲端部署,免除誤刪檔案風險。

OpenClaw 有好幾種重設方式,選錯的話,不是做太少(問題依然存在),就是做太多(刪掉你想保留的資料)。本指南涵蓋每一種重設情境,附上完整指令,讓你選對適合的方式。

你需要哪種重設?

問題 重設類型 指令 會失去什麼
設定值有誤 設定重設 openclaw config reset 僅設定值
AI 模型選錯 模型重設 openclaw config unset ai.model 模型選擇
裝置無法連線 裝置重設 openclaw devices remove --all 裝置配對
記憶內容錯誤或過時 記憶重設 rm -rf ~/.openclaw/memory 對話記憶
Gateway token 錯誤 Token 重設 openclaw doctor --generate-gateway-token Gateway token
什麼都不能用了 恢復原廠設定 rm -rf ~/.openclaw 所有資料
安裝本身就壞了 全新重裝 解除安裝 + 重新安裝 所有資料 + 執行檔

如果不確定該選哪種,先從設定重設開始——它的破壞性最小,而且能解決大部分問題。

設定重設

當你的 openclaw.json 設定有誤、損壞,或你想回到預設值但不想失去裝置配對或記憶時使用。

openclaw config reset

這會將你的設定檔[^1]替換為預設範本。執行後,你需要重新輸入必要的設定:

openclaw config set gateway.mode local
openclaw config set ai.provider anthropic
openclaw config set ai.apiKey "sk-ant-..."
openclaw restart

你的裝置配對、記憶和日誌不受影響。只有 ~/.openclaw/openclaw.json 會被改動。

何時使用: 你改了某個設定後出問題、貼了無效的 JSON 到設定檔中,或 openclaw config validate 顯示錯誤。

重設 AI 模型

當你想切換模型或回到預設模型,而不影響其他任何設定時使用。

清除目前的模型,回到預設值:

openclaw config unset ai.model
openclaw restart

切換到指定模型:

openclaw config set ai.model "claude-sonnet-4-6"
openclaw restart

其他可用的模型包括 claude-opus-4-6、gpt-4o、deepseek-chat,以及使用本地提供者時的任何 Ollama 模型名稱。

何時使用: 目前的模型太貴、太慢,或回應品質不佳。這只會改變處理你提示的模型,其他設定完全不受影響。

重設裝置

當瀏覽器或 Telegram 機器人無法連線,或在 gateway 重啟後看到「device token mismatch」錯誤時使用。

移除所有已配對的裝置:

openclaw devices remove --all
openclaw restart

之後,每個客戶端(瀏覽器、Telegram、手機)都需要重新配對。當裝置連線時,進行核准:

openclaw devices list
openclaw devices approve DEVICE_ID

如果只想重設單一裝置而非全部:

openclaw devices list
openclaw devices remove DEVICE_ID

何時使用: 裝置 token 不符錯誤、已不存在的幽靈「已連線」裝置,或你想撤銷特定客戶端的存取權限。

部署你專屬的 AI 助理

ClawTank 幫你部署 OpenClaw — 不需要伺服器、Docker 或 SSH。含 7 天免費試用。

開始我的免費試用

重設記憶

當 OpenClaw 的記憶包含錯誤資訊、過時事實,或你只是想為對話重新開始時使用。

rm -rf ~/.openclaw/memory
openclaw restart

在 Docker 容器中,記憶目錄位於資料卷內[^3]:

docker exec -it YOUR_CONTAINER bash
rm -rf /app/data/memory
exit
docker restart YOUR_CONTAINER

何時使用: 助理持續引用過時的資訊、記憶變得非常龐大導致速度變慢,或你要將實例轉作其他用途。

重設 Gateway Token

當你看到 token 相關的連線錯誤,但不想失去設定或裝置配對時使用。

openclaw config unset gateway.token
openclaw doctor --generate-gateway-token
openclaw restart

之後,所有已連線的裝置都需要重新配對,因為 gateway 的身份已經改變。

為了防止再次發生這個問題,固定 token 讓它在重啟後持續有效:

openclaw config set gateway.token "a-stable-token-you-choose"

或將它設為環境變數:

export OPENCLAW_GATEWAY_TOKEN="a-stable-token-you-choose"

何時使用: 持續出現「connect failed」或「4008」WebSocket 錯誤,而 openclaw doctor --fix 無法解決。

完全恢復原廠設定

當其他方法都沒用,你需要從頭開始時使用。這會刪除所有 OpenClaw 資料——設定、裝置、記憶、日誌、token。

原生安裝

openclaw gateway stop
rm -rf ~/.openclaw
openclaw setup

openclaw setup 指令會引導你完成初始設定精靈。設定完成後,重新輸入你的 API 金鑰並重啟:

openclaw config set ai.apiKey "sk-ant-..."
openclaw restart

Docker 容器

docker stop YOUR_CONTAINER
docker rm YOUR_CONTAINER
docker volume rm openclaw-data

然後重新建立:

docker run -d \
  --name openclaw \
  -v openclaw-data:/app/data \
  -p 3001:3001 \
  -e OPENCLAW_GATEWAY_TOKEN="your-stable-token" \
  -e ANTHROPIC_API_KEY="sk-ant-..." \
  openclaw-stack

Docker Compose

docker-compose down -v
docker-compose up -d

-v 參數會移除命名卷[^3],而 OpenClaw 的所有持久化資料都儲存在其中。

何時使用: openclaw doctor --fix 已經失敗、部分重設沒有幫助,或你想完全清除一切重新開始。

全新重裝

當 OpenClaw 的執行檔本身可能已損壞,或你在舊版本上想要保證乾淨的起點時使用。

步驟一:移除所有東西

openclaw gateway stop
rm -rf ~/.openclaw
npm uninstall -g openclaw

驗證已完全移除:

which openclaw
# 應該沒有任何輸出

步驟二:重新安裝

macOS / Linux:

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

Windows (PowerShell):

iwr -useb https://openclaw.ai/install.ps1 | iex

步驟三:設定

openclaw setup

這會建立全新的 ~/.openclaw 目錄[^2],使用預設設定,並引導你完成初始設定。

何時使用: 你懷疑執行檔已損壞、跨越多個主要版本升級,或其他所有重設方式都已失敗。

在 Docker 內重設而不重建容器

如果你不想銷毀並重建 Docker 容器,可以從容器內部進行重設:

docker exec -it YOUR_CONTAINER bash
rm -rf /app/data/*
openclaw setup
exit
docker restart YOUR_CONTAINER

這等同於恢復原廠設定,但保留相同的容器和連接埠對應。

任何重設之後

不論你執行了哪種重設,都要驗證 OpenClaw 是否正常運作:

openclaw status          # 應顯示 gateway: running
openclaw doctor          # 應顯示所有檢查通過
openclaw devices list    # 應顯示你的裝置

如果重設後 gateway 沒有執行,檢查日誌:

openclaw logs --tail 20

尋找 [gateway] listening on 這行——出現這行就表示 gateway 已完全啟動。

完全避免重設

ClawTank 透過一鍵容器重建、自動健康檢查和持久化設定來管理你的 OpenClaw 實例。當出問題時,在控制面板點擊「Rebuild」就好,不需要手動執行重設指令。

[^1]: OpenClaw stores its configuration in ~/.openclaw/openclaw.json (native) or /app/data/openclaw.json (Docker). See the OpenClaw GitHub repository for the full default config template. [^2]: The ~/.openclaw data directory uses standard filesystem operations for reads and writes. For details on how Node.js applications interact with directories, see the Node.js fs module documentation. [^3]: Docker containers use named volumes to persist data across restarts and rebuilds. The openclaw-data volume is mounted at /app/data inside the container. See the Docker volume documentation for details on volume lifecycle and management.

喜歡這篇文章嗎?

訂閱電子報,第一時間收到新指南和教學。

相關文章

OpenClaw 原廠重設:如何完全重新開始 [2026]

OpenClaw 原廠重設:如何完全重新開始 [2026]

3 min read

準備好部署 OpenClaw 了嗎?

不需要 Docker、SSH、DevOps。不到 1 分鐘即可部署。

開始我的免費試用
ClawTank
服務條款隱私政策