Repository navigation
Description
Summary
mistgate-client currently targets Windows, while native macOS integration is missing.
I put together a working macOS (Apple Silicon / arm64) port in a fork branch:
- Fork / branch:
https://github.com/akirill0v/mistgate-client/tree/macos-client-port
Important disclaimer: This port was developed largely with Codex + Gemini assistance and verified locally on macOS. Because of that, I am intentionally not opening a PR blindly without maintainers' review first. I'm opening this issue so you can take a look at the approach — feel free to borrow ideas/pieces from it, suggest changes, or let me know if you'd like me to clean it up and submit proper PR(s) for upstream adoption.
What is implemented in the prototype
-
Privileged daemon & IPC (
core/cmd/mistgate-clientd,core/internal/ipc)service_darwin.go:launchdLaunchDaemon lifecycle (install/uninstall) for/Library/PrivilegedHelperTools/com.mistgate.clientd.server_darwin.go: UID-gated Unix domain socket IPC (/Library/Application Support/MistgateIPC/mistgate.sock) with explicitallow-uidenrollment.core/internal/subs/keychain_darwin.go&protect_darwin.go: subscription secrets protected via macOS System Keychain (cgo).
-
Darwin
utun+ gVisor bridge + tunnel backends (core/internal/engine,core/internal/netcfg)- Shared
gvisor_bridge.gowired throughtun_darwin.go(utun) andreal_darwin.go. - Supports Hysteria2, AmneziaWG, VLESS, and TrustTunnel (
scope_darwin.gobinds outbound tunnel/direct sockets to the physical uplink). TrustTunnel already tested! netcfg_darwin.go&dns_darwin.go: split default routes and supplemental DNS configuration (scutil), with rollback on disconnect/utun detach.
- Shared
-
Split-tunneling / Route lists & Smart routing (
routes_darwin.go,real_darwin.go,ui/src/live-routes.ts)- Full support for
all,smart, andselectedroute modes,region:*CIDR lists,geosite:*collections, and custom site rules. RefreshAutoRegionon Darwin via STUN over the physical uplink (darwinPublicAddress) sosmart+autoregion detection works on macOS.- Suppresses
AAAADNS answers (noData) for direct-routed domains when the physical uplink lacks IPv6, preventing stalls on direct connections. - Also fixed a few route-list UI mapping bugs found along the way (
cop→geosite:github-copilotand localized"ms"tile keys infa/ru/zhroute screens).
- Full support for
-
Tauri desktop shell & build (
ui/,.github/workflows/ci.yml)- macOS
.appbundling (prepare-bundle.mjs,tauri-bundle.mjs,tauri.macos.conf.json), LaunchAgent autostart, tray/menu, and notifications. - Platform gating for unsupported Windows-only features (hides/disables per-app rules, updater where unsigned, and unavailable kill-switch status).
- ... but not tested yet.
- macOS
Local verification
- Unit tests pass on macOS arm64 (
go test ./internal/engine/...,node --test ui/src/live-routes.test.mjs, plus Darwinnetcfg/ipc/subs/diagtests). - Tested live with TrustTunnel in
smart:rumode (geosite:category-ru,geosite:apple,geosite:steam, customgithub.com):- Direct-listed and
.ru/.рфresources exit directly throughen0(verified via ISP IP andnettopsockets oncom.mistgate.clientd). - Foreign / default-routed resources exit through the VPN tunnel (verified via VPN exit IP and
nettop).
- Direct-listed and
Known limitations / Not implemented yet
- Kill switch: An experimental PF adapter exists, but it is not wired into the tunnel lifecycle yet (
kill_switchis disabled/reported unavailable on macOS). - Per-app split tunneling: Not implemented on macOS (UI and IPC omit per-app rules on Darwin).
- Signing & distribution: Unsigned local
.appbuild only (no Developer ID signing, notarization,.dmgpackaging, or macOS auto-updater). - Branch hygiene: The prototype branch currently contains local helper files/docs (e.g.
.codegraph/,docs/macos-install.ru.md) that would obviously be stripped out before any clean upstream PR. - Traffic metrics: not worked yet.
Next steps
If there is interest in supporting macOS upstream, I'd be happy to:
- Discuss the architecture (
launchd+ Unix socket +utun+gvisor_bridgesharing with Windows), - Split this into smaller, reviewable PRs (e.g., shared engine refactor first, then Darwin daemon/IPC/netcfg, then Tauri macOS shell), or
- Leave the branch as a reference if you'd prefer a different approach (such as a
NetworkExtension/NEPacketTunnelProviderarchitecture).
Activity
akirill0v commentedon Nov 30, 2026
This branch was meant as an exploratory/test prototype to verify that a macOS implementation works end-to-end with the existing core.
If macOS support isn't already on your immediate roadmap and you're interested in having it, I'd be glad to put together a cleaner, properly structured implementation (without the prototype/local artifacts) and open a PR for review.
limeflash commentedon Dec 1, 2026
Thanks for the prototype — this is real work, and yes: a macOS release is planned, and help with it is welcome.
We read the
macos-client-portbranch. The overall shape (a launchd daemon, utun, the shared gVisor stack, a unix socket with a UID check) is the one we would choose too. To take it in, we'd rather not merge one large branch; a series of small PRs is much easier to review and keeps the Windows build safe:Before that we will add a macOS CI job and a short CONTRIBUTING file on our side, so your PRs have something to run against. Please rebase on the current
mainand leave tool artefacts out of the branch.A few questions:
Signing, notarization and the release itself stay with us.
akirill0v commentedon Dec 1, 2026
Thanks, the split makes sense. I'll wait for the CI/CONTRIBUTING PR (#9) to land, rebase on main,
and open the series in the order you listed. Tool artefacts (.codegraph/, docs/superpowers/) and my
own macOS CI job will not be in any of them.
Answers:
Protocols: only TrustTunnel was tested live. It was the main protocol I needed for the move to macOS.
Hysteria2, AmneziaWG and VLESS have not been tested at all yet. For each of them I'll do a complete
implementation with tests and state the exact coverage in the PR.
Sleep/wake and network change: there is no explicit power-event handling yet. The engine pins the
physical uplink at setup. The watchdog compares the uplink and the owned routes, and on a mismatch it
tears the tunnel down and the session reconnects. So sleep currently behaves like a drop plus a
network change. I haven't tested this systematically. I'll add sleep/wake and Wi-Fi switch checks to
the network-layer PR.
Kill switch: I haven't given it much attention yet, because the branch was an experiment in getting
the client running on macOS. Right now the setting is forced to "off" on macOS and the UI says
protection is unavailable, so the app never claims to block traffic when it doesn't. A standalone PF
anchor adapter exists (pf_darwin.go, with tests) but is not wired in. I'll work out a proper design
that covers fail-closed on activation and tunnel loss, IPv6/DNS leaks and rollback, and propose it
separately. Agreed that a release shouldn't ship without it.
Windows: no Windows behaviour change is intended. After rebasing on the current upstream I'll
restructure the shared-code changes so the Windows implementation stays as it is. Anything that still
touches Windows will be listed explicitly in the PR.
Licensing: I'll settle the legal questions on my side before opening the PRs. All commits in the
series will come from my personal account, not linked to my employer, and will carry a DCO sign-off.
limeflash commentedon Dec 1, 2026
Thanks, that all works for us.
#9 is merged:
mainnow has CONTRIBUTING.md, CODEOWNERS and a macOS job that runsgo vet,go buildandgo testforcore/internal/.... The service binary (cmd/mistgate-clientd) does not build for darwin yet, so the job stops short of it — widen it to./...in the PR that makes it build.Two notes for the series:
The kill switch design can come as an issue before any code — it is easier to agree on the approach there.