安装

快速安装(5 分钟)

逐步安装

1

安装 Go(必需)

Wails 需要 Go 1.25 或更高版本。

go.dev/dl 下载 Windows 安装程序并运行它。

验证安装:

PowerShell
go version  # 应显示 1.25 或更高版本

检查 PATH:

PowerShell
$env:PATH -split ';' | Where-Object { $_ -like '*\go\bin' }

如果为空,请将 C:\Users\YourName\go\bin 添加到你的 PATH 中。

2

安装平台依赖项

WebView2 运行时(通常已预装)

Windows 10/11 默认包含 WebView2。如果缺失:
- 从 [Microsoft](https://developer.microsoft.com/microsoft-edge/webview2/) 下载
- 或者稍后运行 `wails3 doctor`——它将引导你完成

**就这样!** 不需要其他依赖项。
3

安装 Wails CLI

bash
go install github.com/wailsapp/wails/v3/cmd/wails3@latest

这将把 wails3 命令安装到 ~/go/bin(或在 Windows 上为 %USERPROFILE%\go\bin)。

4

验证安装

bash
wails3 doctor

预期输出(或类似):

Wails (v3.0.0-dev)  Wails Doctor

# System

┌──────────────────────────────────────────────────┐
| Name          | MacOS                            |
| Version       | 26.0                             |
| ID            | 25A354                           |
| Branding      | MacOS 26.0                       |
| Platform      | darwin                           |
| Architecture  | arm64                            |
| Apple Silicon | true                             |
| CPU           | Apple M2 Pro                     |
| CPU 1         | Apple M2 Pro                     |
| CPU 2         | Apple M2 Pro                     |
| GPU           | 16 cores, Metal Support: Metal 4 |
| Memory        | 16 GB                            |
└──────────────────────────────────────────────────┘

# Build Environment

┌─────────────┬─────────────────┐
| Wails CLI   | 已安装的版本 |
| Go Version  | go1.24.6        |
└─────────────┴─────────────────┘

# Dependencies

┌─────────────────┬─────────────────────────────────────────────────┐
| npm             | 11.6.2                                          |
| *NSIS           | Not Installed. Install with `brew install...`.  |
| Xcode cli tools | 2412                                            |
└─────────────────┴─────────────────────────────────────────────────┘

# Checking for issues

SUCCESS No issues found

# Diagnosis

SUCCESS Your system is ready for Wails development!
5

安装 npm(可选但推荐)

大多数 Wails 模板使用 npm 进行前端工具链管理。

nodejs.org 下载并运行安装程序。

验证:

PowerShell
npm --version

故障排除

wails3 命令未找到

原因: ~/go/bin(或 %USERPROFILE%\go\bin)不在 PATH 中。

解决方案:

  1. 打开"环境变量"(在开始菜单中搜索)
  2. 在"用户变量"下,找到 Path
  3. 点击"编辑"→“新建”
  4. 添加:C:\Users\YourName\go\bin(将 YourName 替换为你的用户名)
  5. 点击所有对话框中的"确定"
  6. 重启终端

验证:

PowerShell
$env:PATH -split ';' | Where-Object { $_ -like '*\go\bin' }

wails3 doctor 报告缺少依赖项

Linux: 输出会告诉你需要安装哪些软件包。示例:

❌ webkit2gtk not found
   Install with: sudo apt install libwebkit2gtk-4.1-dev

Windows: 如果缺少 WebView2:

  • Microsoft 下载
  • 或者运行你的第一个应用时会自动安装

macOS: 如果缺少 Xcode 工具:

bash
xcode-select --install

Go 版本过旧

Wails v3 需要 Go 1.25+。如果你使用的是旧版本:

go.dev/dl 下载最新版本并重新安装。

开发版本(最新开发版)

想要使用主开发分支中的最新代码吗?这让你能在正式发布前访问新功能和修复,但也伴随着 bug 和破坏性更改的风险。仅推荐给贡献者或需要测试即将推出功能的人员。

bash
git clone https://github.com/wailsapp/wails.git
cd wails
git checkout v3
cd v3/cmd/wails3
go install

下一步

安装完成! 你的系统已准备好进行 Wails 开发。

构建你的第一个应用

在 10 分钟内创建一个可用的应用程序。

第一个应用教程 →

探索模板

查看开箱即用的可用内容。

bash
wails3 init -l  # 列出模板

遇到问题? 请在 Discord 提问或提交 issue

Edit page

Last updated: