Keep it running
Pick one way to run the daemon. Each one owns the process, so don’t combine them.
The simplest option, on any OS. It starts wx serve in the background for the current user.
wx daemon startwx daemon statuswx daemon logs --followwx daemon stopRestarts on failure and starts with your user session. Install the example user unit:
mkdir -p ~/.config/systemd/user ~/.config/agent-wechat/servercurl -fsSLo ~/.config/systemd/user/agent-wechat-native.service \ https://raw.githubusercontent.com/thisnick/agent-wechat/main/deploy/native/agent-wechat-native.servicetest -f ~/.config/agent-wechat/server/config.toml || echo 'schemaVersion = 1' > ~/.config/agent-wechat/server/config.tomlBefore enabling it, edit the unit:
ExecStart=runs~/.local/bin/wx. Change it ifcommand -v wxsays otherwise.- If you logged in with
--official, add WeChat’s folders toReadWritePaths=, for example%h/xwechat_files %h/.xwechat. By default the unit can only write to~/.local/share/agent-wechat.
systemctl --user daemon-reloadsystemctl --user enable --now agent-wechat-nativeOn a headless server, run loginctl enable-linger so the service starts without a login.
Start from the example compose.yaml and server.toml, then:
-
Set
image:toghcr.io/thisnick/agent-wechat-native:latestand remove thebuild:section. -
Create an API token: one copy for your CLI, one owned by the container user (UID 10001).
Terminal window umask 077; mkdir -p ~/.config/agent-wechat secretshead -c 32 /dev/urandom | base64 > ~/.config/agent-wechat/box-tokensudo install -m 600 -o 10001 -g 10001 ~/.config/agent-wechat/box-token secrets/api-token -
Start it and log in from the host:
Terminal window docker compose up -dwx config servers add box --url http://127.0.0.1:6174 \--token-file ~/.config/agent-wechat/box-tokenwx --server-name box accounts create --alias mewx --server-name box auth login
To use existing WeChat for Linux data instead, add its folder (the one containing xwechat_files and .xwechat) to volumes: as /home/you:/profiles/wechat. Then log in with --official=/profiles/wechat. The container runs as UID 10001, so that user needs write access to it.
On macOS and Windows, Docker Desktop runs the same image. The example uses host networking, so turn it on under Settings › Resources › Network.