Skip to content
CoreMacs
Security & signingGuide

"No route to host" from a LaunchAgent on macOS 15: fixing Local Network access for CI runners

On macOS 15 and later, launchd agents are not automatically allowed on the local network, so runner jobs fail with "No route to host" and the approval prompt may never appear. Fix the binary's identity, record an approval once, run as a daemon, or exempt the subnet.

CoreMacs News Desk·Published ·Last verified ·7 min read
A silver Mac mini on a wooden desk with power and USB-C cables plugged into its rear ports, beside a display and keyboard.

On macOS 15 and later, local network privacy blocks outgoing connections to LAN addresses from any program that has not been granted the Local Network privilege, and launchd agents, unlike daemons, are not allowed automatically. A runner or scheduled job started as a LaunchAgent therefore gets No route to host when it reaches a LAN server or a local VM, and on a headless Mac nobody sees or answers the alert. Fix it by giving the binary a stable identity and recording an approval once, by running the job as a LaunchDaemon where the tool supports it, or, on macOS 15.5 and later, by exempting the subnet with AllowedEthernetLocalNetworkAddresses and AllowedWiFiLocalNetworkAddresses and restarting.

What the failure looks like

The Packer plugin for Tart documents this line when Packer tries to reach a freshly booted VM:

ssh: connect to host [...] port 22: No route to host

Go programs report connect: no route to host. Underneath it is EHOSTUNREACH. The pattern that identifies local network privacy rather than a real routing problem:

  • The same command works from Terminal or an SSH session.
  • The job reaches internet hosts but not addresses on the LAN or the VM network.
  • No entry for the tool appears under System Settings > Privacy & Security > Local Network, and no alert is shown.

Why LaunchAgents are blocked when Terminal is not

According to TN3179, macOS automatically allows local network access for any daemon started by launchd, any program running as root, and command-line tools run from Terminal or over SSH, including their child processes. The technote states that the daemon exception does not apply to launchd agents. Everything else waits for the user to grant the privilege.

Making an outgoing TCP connection, sending UDP and connecting a UDP socket to a local address all need access. Listening for incoming TCP connections does not. The check sits deep in the networking stack, so it applies to BSD sockets, Network framework and URL Loading System alike, which is why ssh, Packer and Go clients all fail the same way.

Three details explain the missing prompt:

  • Short-lived processes. TN3179 notes (FB16131937) that macOS fails to display the alert when a process performs a local network operation and exits immediately after it fails. An agent that tries once and quits never gets asked.
  • Identity. Local network privacy tracks programs by code signature and uses the main executable's UUID. Unsigned or ad hoc signed code, or an executable without a unique LC_UUID, may behave unpredictably.
  • No one at the screen. The decision is stored per user account. On a headless Mac the alert, if it appears, sits in a GUI session nobody is watching.

How to fix it

  1. Check that the binary has a build UUID. TN3178 gives the commands:
    dwarfdump --uuid /path/to/binary
    otool -l /path/to/binary | grep -B 1 -A 2 LC_UUID
    If nothing is printed, rebuild or upgrade. Go binaries linked by the default Go linker had no LC_UUID (golang/go #68678); the Go 1.24 release notes say the linker now generates it on macOS by default. For older toolchains, the reporter in that issue worked around it with -ldflags="-linkmode=external", and notes it may not work when cross-compiling for macOS from Linux. If you build the tool yourself, sign it with an Apple-issued identity rather than ad hoc, as TN3179 recommends.
  2. Record the approval once, in the agent's GUI session. Sign in to the Mac through the console or Screen Sharing as the user that owns the agent, make the agent perform a local network operation, and click Allow. If the job exits on the first failure, make it wait or retry instead; in the Apple Developer Forums thread a short delay before exiting made the alert appear reliably. Once the state is recorded, later runs work without a prompt.
  3. Tell macOS which app the agent belongs to. For an agent that ships with an app but is not installed through SMAppService, TN3179 says to set AssociatedBundleIdentifiers in the launchd property list. Apple's Service Management documentation adds that the executable's Team ID must match the app's. This does not help a bare command-line tool with no app.
  4. Use a LaunchDaemon where the tool supports it. A plist in /Library/LaunchDaemons is a daemon and, running as root, is allowed automatically. The launchd.plist man page notes that UserName applies only to jobs in the system domain; TN3179 does not say whether a daemon that drops to another user with UserName keeps the exemption, so test that on your macOS version before relying on it. GitLab Runner is the exception: its macOS install guide says it runs as a user-mode LaunchAgent at ~/Library/LaunchAgents/gitlab-runner.plist and does not support running as a LaunchDaemon.
  5. On macOS 15.5 and later, exempt the subnets you need. This changes a privacy setting system-wide: every program, not just your runner, can then reach those addresses. Keep the list as narrow as your VMs and build servers allow. TN3179's example for link-local addresses:
    sudo defaults write com.apple.network.local-network AllowedEthernetLocalNetworkAddresses -array "169.254.0.0/16"
    sudo defaults write com.apple.network.local-network AllowedWiFiLocalNetworkAddresses -array "169.254.0.0/16"
    The packer-plugin-tart README suggests the full private ranges for VM builds, after first updating Packer:
    sudo defaults write com.apple.network.local-network AllowedEthernetLocalNetworkAddresses -array "10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16"
    sudo defaults write com.apple.network.local-network AllowedWiFiLocalNetworkAddresses -array "10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16"
    Each value is an IPv4 or IPv6 network in CIDR notation. Restart the Mac; the change does not take effect until you do.

How to confirm it worked

  • Run the job through launchd, not from Terminal. A Terminal or SSH test proves nothing, because those sessions are exempt.
  • For an approval, check that the program appears and is switched on under Privacy & Security > Local Network for the agent's user.
  • For an exemption, read the values back with sudo defaults read com.apple.network.local-network and confirm the Mac was restarted after the write.
  • In your own Swift code, an NWConnection that is blocked enters the waiting state with localNetworkDenied as the unsatisfied reason, which TN3179 shows how to detect.

Edge cases

  • Exemptions arrived in 15.5. TN3179 says the two defaults debuted in macOS 15.5, so do not rely on them on 15.0 to 15.4. TN3179 also recommends retesting 15.0 problems on 15.1 or later, which fixed several bugs.
  • Interface type matters. AllowedEthernetLocalNetworkAddresses covers wired Ethernet and AllowedWiFiLocalNetworkAddresses covers Wi-Fi. TN3179 does not say how virtual VM network interfaces are classified. Both TN3179's example and the Tart README set both keys, so set both.
  • Resetting a decision. The add and remove buttons in the Local Network list exist only from macOS 27.2. On earlier versions there is no reset; TN3179 suggests a fresh user account or a VM snapshot for retesting.
  • MDM. TN3179 states that device managers cannot configure local network privacy with MDM, so fleets rely on the defaults above or on approvals.
  • Shell scripts and wrappers. In the forum thread, Apple DTS says it normally recommends against shell scripts when user-controlled privileges such as Local Network are involved, although removing the script alone did not fix that case. Where you can, have the agent run the signed binary that does the network work directly.

How to prevent it on new build machines

  • Use toolchains that emit a unique LC_UUID, such as Go 1.24 or later, and check new binaries with dwarfdump --uuid.
  • Write jobs to retry or wait for connectivity instead of exiting on the first refused connection.
  • Prefer LaunchDaemons for jobs that do not need a GUI session and whose vendor supports it.
  • Add the subnet exemption to your provisioning on macOS 15.5 and later, restart as part of setup, and keep the subnet list short.

Sources

Share