Cài đặt¶
Đã làm theo Getting Started? Bạn đã sẵn sàng — trang này dành cho các phương pháp cài đặt thay thế, hướng dẫn theo từng nền tảng và bảo trì.
Yêu cầu hệ thống¶
- Node 22+ (script cài đặt sẽ tự cài nếu thiếu)
- macOS, Linux hoặc Windows
pnpmchỉ khi bạn build từ mã nguồn
Phương thức cài đặt¶
```
<Tabs>
<Tab title="macOS / Linux / WSL2">
```bash
curl -fsSL https://openclaw.ai/install.sh | bash
```
</Tab>
<Tab title="Windows (PowerShell)">
```powershell
iwr -useb https://openclaw.ai/install.ps1 | iex
```
</Tab>
</Tabs>
Vậy là xong — script sẽ xử lý việc phát hiện Node, cài đặt và onboarding.
Để bỏ qua onboarding và chỉ cài binary:
<Tabs>
<Tab title="macOS / Linux / WSL2">
```bash
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
```
</Tab>
<Tab title="Windows (PowerShell)">
```powershell
& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard
```
</Tab>
</Tabs>
Để xem tất cả cờ, biến môi trường và tùy chọn CI/tự động hóa, xem [Installer internals](/install/installer).
```
```
<Tabs>
<Tab title="npm">
```bash
npm install -g openclaw@latest
openclaw onboard --install-daemon
```
<Accordion title="lỗi build sharp?">
Nếu bạn đã cài libvips toàn cục (thường gặp trên macOS qua Homebrew) và `sharp` thất bại, hãy buộc dùng binary dựng sẵn:
```bash
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest
```
Nếu bạn thấy `sharp: Please add node-gyp to your dependencies`, hãy cài công cụ build (macOS: Xcode CLT + `npm install -g node-gyp`) hoặc dùng biến môi trường ở trên.
</Accordion>
</Tab>
<Tab title="pnpm">
```bash
pnpm add -g openclaw@latest
pnpm approve-builds -g # approve openclaw, node-llama-cpp, sharp, etc.
openclaw onboard --install-daemon
```
<Note>
pnpm yêu cầu phê duyệt rõ ràng cho các gói có script build. Sau khi lần cài đầu tiên hiển thị cảnh báo "Ignored build scripts", hãy chạy `pnpm approve-builds -g` và chọn các gói được liệt kê.
</Note>
</Tab>
</Tabs>
```
```
<Steps>
<Step title="Clone và build">
Clone [repo OpenClaw](https://github.com/openclaw/openclaw) và build:
```bash
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm ui:build
pnpm build
```
</Step>
<Step title="Liên kết CLI">
Làm cho lệnh `openclaw` khả dụng toàn cục:
```bash
pnpm link --global
```
Hoặc bỏ qua bước liên kết và chạy lệnh qua `pnpm openclaw ...` từ bên trong repo.
</Step>
<Step title="Chạy onboarding">
```bash
openclaw onboard --install-daemon
```
</Step>
</Steps>
Để xem các quy trình phát triển chuyên sâu hơn, xem [Thiết lập](/start/setup).
```
Các phương thức cài đặt khác¶
Sau khi cài đặt¶
Xác minh mọi thứ hoạt động bình thường:
openclaw doctor # check for config issues
openclaw status # gateway status
openclaw dashboard # open the browser UI
If you need custom runtime paths, use:
OPENCLAW_HOMEfor home-directory based internal pathsOPENCLAW_STATE_DIRfor mutable state locationOPENCLAW_CONFIG_PATHfor config file location
See Environment vars for precedence and full details.
Xử lý sự cố: không tìm thấy openclaw¶
node -v
npm -v
npm prefix -g
echo "$PATH"
Nếu $(npm prefix -g)/bin (macOS/Linux) hoặc $(npm prefix -g) (Windows) không nằm trong $PATH của bạn, shell của bạn không thể tìm thấy các binary npm toàn cục (bao gồm openclaw).
Cách khắc phục — thêm nó vào file khởi động shell của bạn (~/.zshrc hoặc ~/.bashrc):
export PATH="$(npm prefix -g)/bin:$PATH"
Trên Windows, thêm đầu ra của npm prefix -g vào PATH của bạn.
Then open a new terminal (or rehash in zsh / hash -r in bash).