061b2bb46e5c081f9231a4cfcd06784e7c32122a
- clash.ps1: 1:1 port of macOS clash script to PowerShell 7
- TUN-only mode, auto UAC elevation via Start-Process -Verb RunAs
- Subcommands: start/stop/restart/reload/status/link/open/edit/
log/cleanup/doctor/verge-off/help + interactive menu
- win_adapt_config: strip Linux-only fields, stack system→gvisor
- wintun adapter + route cleanup for network recovery
- ANSI colors (pwsh 7 + Windows Terminal)
- 5-path mihomo binary detection (Get-Command→scoop→~/Mihomo→LOCALAPPDATA→ProgramFiles)
- install.ps1: one-command Windows deploy
- Detect pwsh 7, download mihomo v1.19.15 + wintun.dll 0.14.1
- Architecture-aware (amd64/arm64)
- Deploy clash.ps1 to PATH
- README.md: add Windows section
- .gitignore: add wintun.dll, *.exe
Clash — Mihomo 内核管理脚本
一份 YAML 配置同时在 OpenWRT / macOS / Windows 上使用,启动时自动适配平台。
macOS
使用
| 命令 | 说明 |
|---|---|
clash |
交互菜单 |
clash start |
启动 |
clash stop |
停止 |
clash restart |
重启 |
clash reload |
热重载 |
clash status |
状态 |
clash link |
源文件路径 |
clash cleanup |
网络修复 |
部署
git clone git@github.com:lukeopen/Clash.git
cd Clash && zsh install.sh
cp /path/to/config.yaml ~/Mihomo/
clash start
依赖
- Homebrew +
brew install mihomo
Windows
使用
| 命令 | 说明 |
|---|---|
clash.ps1 |
交互菜单 |
clash.ps1 start |
启动 (TUN 模式) |
clash.ps1 stop |
停止 |
clash.ps1 restart |
重启 |
clash.ps1 reload |
热重载 |
clash.ps1 status |
状态 |
clash.ps1 link |
源文件路径 |
clash.ps1 cleanup |
网络修复 |
部署
git clone https://github.com/lukeopen/Clash.git
cd Clash
pwsh install.ps1
# 把 .yaml 配置文件放入 ~/Mihomo/
clash.ps1 start
要求
- Windows 11 + PowerShell 7 (
winget install Microsoft.PowerShell) - TUN 模式需要管理员权限(UAC 关闭时自动提权无感)
目录结构
Clash/
├── clash # macOS 管理脚本
├── install.sh # macOS 部署脚本
├── clash.ps1 # Windows 管理脚本
└── install.ps1 # Windows 部署脚本
~/Mihomo/ ← 放 YAML 配置文件
~/.config/mihomo/ ← 运行时数据(config.yaml / pid / log / ui)
Languages
PowerShell
58.4%
Shell
41.6%