MOSHLINE
MOSHLINE / DOCSField manualOpen +
Docs/Troubleshooting03

Fix “Host daemon is not reachable” on macOS

Recover the Moshline LaunchAgent when Quick Setup installed the package but Doctor cannot reach the daemon or find its terminal attach socket.

Updated: 2026-07-23Applies to: macOS LaunchAgent com.moshline.host

Outcome

The LaunchAgent is loaded, the daemon answers on localhost, the attach socket exists, and moshline-host doctor returns PASS for the Host daemon.

Recognize this failure

This means the package and hook files may already be installed, but the background service has not started. Fix the daemon before debugging tmux, approvals, or the App.

Typical Doctor output
$ FAIL  Host daemon is not reachable: fetch failed
$ PASS  Multiplexer adapter check waits for the host daemon
$ FAIL  Terminal attach socket is missing; restart the host daemon

1. Inspect the installed service

Read-only checks
$ moshline-host version
$ moshline-host doctor
$ launchctl print "gui/$(id -u)/com.moshline.host"
$ plutil -p "$HOME/Library/LaunchAgents/com.moshline.host.plist"
$ ls -ld "$HOME/Library/Logs" "$HOME/Library/Logs/Moshline"
$ tail -n 100 "$HOME/Library/Logs/Moshline/host.log"

2. Verify the absolute Node and CLI paths

The LaunchAgent stores absolute paths. This works with NVM and asdf until that exact Node version is removed. In the plist output, copy ProgramArguments[0] and ProgramArguments[1], then verify both files exist and are executable.

Compare current shell paths
$ command -v node
$ command -v moshline-host
$ node --version
$ moshline-host version

3. Reload and kickstart only the Moshline LaunchAgent

These commands restart the Moshline Host Helper service. They do not delete your repository, Agent sessions, SSH keys, or Host config.

Service repair
$ mkdir -p "$HOME/Library/Logs/Moshline"
$ launchctl bootout "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.moshline.host.plist" 2>/dev/null || true
$ launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/com.moshline.host.plist"
$ launchctl kickstart -k "gui/$(id -u)/com.moshline.host"

4. Verify health and attach

Expected checks
$ launchctl print "gui/$(id -u)/com.moshline.host" | head -40
$ curl -fsS http://127.0.0.1:24000/health
$ tail -n 100 "$HOME/Library/Logs/Moshline/host.log"
$ moshline-host doctor

5. Re-run Quick Setup if the service still cannot start

Quick Setup refreshes the package, service definition, hooks, and saved executable paths while preserving the paired Host identity and unrelated provider hooks.

  • If npm reports a permissions error, the old global install may be root-owned.
  • If the log reports EADDRINUSE, identify the process already using port 24000 before restarting.
  • If curl works but Doctor reports the wrong host identity, confirm the daemon and ~/.config/moshline/host.json belong to the same user.
  • If Remote Login is off, enable it before repeating the phone-generated setup command.
Repair install
$ curl -fsSL https://raw.githubusercontent.com/NomadShell/Scripts/main/quick-setup.sh | bash
$ moshline-host doctor

Reference paths

ItemPath or label
LaunchAgent labelcom.moshline.host
LaunchAgent plist~/Library/LaunchAgents/com.moshline.host.plist
Host config~/.config/moshline/host.json
Daemon log~/Library/Logs/Moshline/host.log
Default local health port127.0.0.1:24000
Attach socket~/.local/share/moshline/moshline-host.sock

Related