---
title: "macOS 和 Windows 错误 | Wantastic Docs"
description: "launchd、Gatekeeper、托盘、sc.exe 和 Windows 服务错误及最简单的修复方法。"
url: "https://wantastic.app/zh/docs/errors-macos-windows"
category: "Troubleshooting"
reading_time: "6 分钟"
---

# macOS 和 Windows 错误

launchd、Gatekeeper、托盘、sc.exe 和 Windows 服务错误及最简单的修复方法。

> **Outcome:** wantasticd 服务开机自动运行，且 wantasticd status 显示 Connected。

## Before you start

- macOS 上使用 sudo，Windows 上以管理员身份运行 PowerShell。

## 开始之前

- macOS：使用快速安装进行安装和认领。日志位于 /Library/Logs/Wantastic/wantasticd.log。
- Windows：使用令牌安装。Windows 上不显示认领二维码。
- Windows 没有日志文件。在前台运行一次服务以查看错误。

### macOS

Terminal:

```bash
curl -fsSL https://get.wantastic.app/install.sh | sudo sh; sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo launchctl kickstart -k system/com.wantastic.wantasticd
```

### Windows

以管理员身份打开 PowerShell（开始 → 输入 powershell → Run as administrator → Yes），粘贴这一行，然后在浏览器中批准设备。

PowerShell（管理员）:

```powershell
irm https://get.wantastic.app/install.ps1 | iex
```

## 检查要点

### macOS

Terminal:

```bash
wantasticd status
tail -n 50 /Library/Logs/Wantastic/wantasticd.log
sudo launchctl kickstart -k system/com.wantastic.wantasticd
```

### Windows

PowerShell（管理员）:

```powershell
sc.exe query wantasticd
sc.exe stop wantasticd
& "C:\Program Files\Wantastic\wantasticd.exe" connect --config "C:\ProgramData\Wantastic\config.conf" --tray=false -v *> "$env:TEMP\wantasticd.log"
Get-Content "$env:TEMP\wantasticd.log" -Tail 50
```

*失败：普通 PowerShell 窗口: 该窗口没有管理员权限，因此安装程序停止。*

```
$ PS C:\Users\you> irm https://get.wantastic.app/install.ps1 | iex
Administrator privileges are required.
Right-click PowerShell, choose 'Run as administrator', and run again:
```

*已修复：Administrator: Windows PowerShell: 在通过 Run as administrator 打开的窗口中运行同一行，然后在浏览器中批准。*

```
$ PS C:\Windows\system32> irm https://get.wantastic.app/install.ps1 | iex
wantasticd v1.0.54+377f3c0 is installed and running as a Windows Service.
```

## 速查表

| 错误 | 最简单的修复方法 |
| --- | --- |
| Error: on macOS the installer needs root. | 在 sh 前加上 sudo。 |
| Interface name must be utun[0-9]* | 取消设置 WANTASTIC_TUN_NAME。 |
| Killed by Gatekeeper / "cannot be opened" | 移除隔离标记并签名。 |
| 托盘显示 "Status: Daemon not running" | 重启服务。 |
| Failed to <action> (sc.exe exit code N). | 关闭 services.msc 或重启。 |
| The service is installed but not started because this device is not logged in yet. | wantasticd login --no-connect, then Start-Service wantasticd. |
| Administrator privileges are required. | 通过 Run as administrator（以管理员身份运行）打开 PowerShell。 |
| Error creating interface: … (Wintun) | 以管理员身份运行；在杀毒软件中放行。 |

## Verify the result

- wantasticd status 显示 Connected。
- 设备在 Devices 中显示为 Online。

## Common issues

### macOS 安装立即停止。

```
Error: on macOS the installer needs root.
```

- **Where:** install.sh (macOS)
- **Likely cause:** 安装程序没有使用 sudo 运行。
- **Fix:** 在 sh 前加上 sudo 运行快速安装，然后认领设备。

1. 运行该命令。
2. 打开 Claim URL，登录并点击 Claim Device。
3. 出现 "Device claimed" 后，按 Ctrl+C。
4. 运行：sudo launchctl kickstart -k system/com.wantastic.wantasticd

Terminal:

```bash
curl -fsSL https://get.wantastic.app/install.sh | sudo sh; sudo wantasticd genkey
```

- **Verify:** wantasticd status 显示 Connected。

### macOS：已认领，但设备仍为 Offline。

- **Where:** wantasticd genkey (macOS)
- **Likely cause:** genkey 未使用 sudo 运行，因此配置保存在 ~/Library/Application Support/Wantastic，而服务不会读取该位置。
- **Fix:** 使用 sudo 重新运行 genkey，重新认领，然后重启服务。

Terminal:

```bash
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo launchctl kickstart -k system/com.wantastic.wantasticd
```

- **Verify:** wantasticd status 显示 Connected。

### macOS 拒绝自定义 TUN 名称。

```
Interface name must be utun[0-9]*
```

- **Where:** wantasticd 日志（macOS）
- **Likely cause:** WANTASTIC_TUN_NAME 设置的名称不是以 utun 开头。
- **Fix:** 删除该设置。macOS 会自动选择 utun 名称。

Terminal:

```bash
unset WANTASTIC_TUN_NAME
sudo launchctl kickstart -k system/com.wantastic.wantasticd
```

- **Verify:** wantasticd status 显示 Mode TUN (utunN)。

### macOS 终止了二进制文件，或提示无法打开。

- **Where:** macOS Gatekeeper
- **Likely cause:** 手动复制后，文件带有隔离标记或签名无效。
- **Fix:** 移除隔离标记并为二进制文件签名。

Terminal:

```bash
sudo xattr -d com.apple.quarantine /usr/local/bin/wantasticd
sudo codesign -f -s - /usr/local/bin/wantasticd
sudo launchctl kickstart -k system/com.wantastic.wantasticd
```

- **Verify:** wantasticd version 可以运行。

### 设备已列出，但从 Mac 上无法访问。

- **Where:** macOS
- **Likely cause:** 隧道已断开，或路由没有经过 utun。
- **Fix:** 重启服务，然后检查路由。

Terminal:

```bash
sudo launchctl kickstart -k system/com.wantastic.wantasticd
wantasticd status
route -n get <peer-ip>
```

- **Verify:** route -n get 显示 interface: utunN。

### 托盘提示守护进程未运行。

```
Status: Daemon not running
```

- **Where:** macOS 菜单栏应用
- **Likely cause:** 服务已停止或崩溃。
- **Fix:** 重启服务并检查日志。

Terminal:

```bash
sudo launchctl kickstart -k system/com.wantastic.wantasticd
tail -n 50 /Library/Logs/Wantastic/wantasticd.log
```

- **Verify:** 托盘显示 Connected。

### macOS 防火墙阻止了 P2P。

```
[P2P] Could not add … to the application firewall
```

- **Where:** wantasticd 日志（macOS）
- **Likely cause:** macOS 防火墙拒绝了该规则。"Could not allow …" 情况类似。
- **Fix:** 在 System Settings → Network → Firewall → Options 中，允许 wantasticd 的传入连接。

- **Verify:** wantasticd peers 显示直连路径。

### Wi-Fi 名称显示为已隐藏。

- **Where:** 控制台 / 设备信息（macOS）
- **Likely cause:** wantasticd 的定位服务已关闭。
- **Fix:** 在 System Settings → Privacy & Security 中为 wantasticd 开启定位服务。

- **Verify:** Wi-Fi 名称可见。

### 旧的日志位置。

- **Where:** macOS
- **Likely cause:** 1.0.50 之前的版本，日志位于 /var/log/wantasticd.log。
- **Fix:** 当前版本请使用 /Library/Logs/Wantastic/wantasticd.log。

- **Verify:** 日志文件中有最近的记录。

### 安装过程中 sc.exe 步骤失败。

```
Failed to <action> (sc.exe exit code N).
```

- **Where:** install.ps1
- **Likely cause:** 通常为退出码 1072：服务管理器（services.msc）或其他工具占用了该服务。
- **Fix:** 关闭服务管理器、任务管理器和事件查看器，或重启。然后重新运行 install.ps1。

PowerShell（管理员）:

```powershell
irm https://get.wantastic.app/install.ps1 | iex
```

- **Verify:** 安装程序完成。

### 安装后 Windows 服务未运行。

```
The wantasticd service did not reach the Running state.
```

- **Where:** install.ps1
- **Likely cause:** 登录失败，因此配置只是占位内容。
- **Fix:** 使用新令牌登录，然后重启服务。

PowerShell（管理员）:

```powershell
& "C:\Program Files\Wantastic\wantasticd.exe" login --no-connect --token <TOKEN>
Restart-Service wantasticd
```

- **Verify:** sc.exe query wantasticd 显示 RUNNING。

### 服务未在开机时启动。

```
The wantasticd service was not configured for automatic startup.
```

- **Where:** install.ps1
- **Likely cause:** 设置失败，或被策略修改。
- **Fix:** 手动设置为自动启动。

PowerShell（管理员）:

```powershell
sc.exe config wantasticd start= auto
```

- **Verify:** sc.exe qc wantasticd 显示 AUTO_START。

### 安装后服务不存在。

```
The wantasticd service was not found after installation.
```

- **Where:** install.ps1
- **Likely cause:** PowerShell 未以管理员身份运行，或被策略阻止。
- **Fix:** 以管理员身份在 PowerShell 中重新运行 install.ps1。

PowerShell（管理员）:

```powershell
irm https://get.wantastic.app/install.ps1 | iex
```

- **Verify:** sc.exe query wantasticd 正常工作。

### Windows 安装期间登录失败。

```
Login did not complete (exit N).
```

- **Where:** install.ps1
- **Likely cause:** 浏览器中的批准未及时完成或被拒绝，或令牌被拒绝。
- **Fix:** 重新登录并批准设备，然后启动服务。

PowerShell（管理员）:

```powershell
wantasticd login --no-connect
Start-Service wantasticd
```

- **Verify:** wantasticd status 显示 Connected。

### 安装程序立即停止。

```
Administrator privileges are required.
```

- **Where:** install.ps1
- **Likely cause:** PowerShell 未以管理员身份打开。
- **Fix:** 点击开始，输入 powershell，点击 Run as administrator，再点击 Yes，然后重新粘贴这一行。

PowerShell（管理员）:

```powershell
irm https://get.wantastic.app/install.ps1 | iex
```

- **Verify:** 安装程序完成。

### Windows 服务管理器错误。

```
windows service failed: …
```

- **Where:** 事件查看器 / 前台运行
- **Likely cause:** 服务包装程序失败。"failed to determine if interactive session" 与此相关。
- **Fix:** 使用 -v 在前台运行以查看真正的错误，然后以管理员身份重新安装。

- **Verify:** 服务正在运行。

### 无法创建 Wintun 适配器。

```
Error creating interface: …
```

- **Where:** wantasticd (Windows)
- **Likely cause:** PowerShell 未提升权限，或杀毒软件阻止了 Wintun 驱动。
- **Fix:** 以管理员身份运行，并在安全软件中放行 C:\Program Files\Wantastic。

- **Verify:** wantasticd status 显示 Mode TUN (wantastic0)。

### Windows 上看不到二维码或登录提示。

- **Where:** install.ps1 · wantasticd login (Windows)
- **Likely cause:** Windows 上较旧的 wantasticd 版本无法向 PowerShell 输出内容。
- **Fix:** 按 Ctrl+C，在 Account → Secrets 中创建令牌，然后用它安装。

PowerShell（管理员）:

```powershell
& ([scriptblock]::Create((irm https://get.wantastic.app/install.ps1))) -Token <TOKEN>
```

- **Verify:** 安装程序提示服务正在运行。

### 在 Windows 上卸载。

- **Where:** Windows
- **Likely cause:** 没有卸载脚本。
- **Fix:** 停止并删除服务，然后删除相关文件夹。

PowerShell（管理员）:

```powershell
sc.exe stop wantasticd; sc.exe delete wantasticd
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Run -Name Wantastic -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\Program Files\Wantastic","C:\ProgramData\Wantastic"
```

- **Verify:** sc.exe query wantasticd 提示该服务不存在。

## Continue with

- [Troubleshooting: start here](https://wantastic.app/zh/docs/troubleshooting): Fix most problems in 3 steps. If that does not work, find your exact error in the table and open the matching guide.
- [Install on macOS](https://wantastic.app/zh/docs/install-macos): Install wantasticd on a Mac (Apple silicon or Intel) in 2 minutes: one Terminal command, scan a QR code, click Claim Device.
- [Install on Windows](https://wantastic.app/zh/docs/install-windows): Install wantasticd on Windows 10/11 and Windows Server: open PowerShell as Administrator, paste one line, approve the device in your browser.
- [Installer errors (install.sh and install.ps1)](https://wantastic.app/zh/docs/errors-installer): Every message the Wantastic installers print when they stop, what it means and the easiest fix.
- [Update and rollback errors](https://wantastic.app/zh/docs/errors-update): Fix self-update failures, read the update log and roll back to the previous binary.
