A native SwiftUI utility that selects a managed section of /etc/hosts from the current Wi-Fi SSID, default-router IP address, or default-router MAC address.
The app edits JSON-backed profiles and installs an embedded Swift daemon as /Library/Application Support/HostsManager/HostsManagerDaemon. A system LaunchDaemon runs it as root so network changes can be handled without repeated password prompts. Installation and removal require an administrator password.
The daemon is independent of the management app. It starts at system boot, continues running after the GUI quits, does not require a logged-in user, and is restarted by launchd if it exits unexpectedly. Turning Enabled off leaves the daemon installed but removes its managed hosts block; Remove Service unloads and deletes the installed daemon.
The daemon only owns this section of /etc/hosts:
# ## ============= ## HostsManager ## ============= ## #
<hosts data>
# ## =====END===== ## HostsManager ## =====END===== ## #
If the markers are absent, the section is appended. If they are present, only that section is replaced. Disabling the manager, finding no matching profile, or removing the service removes the managed section.
The GUI writes /Library/Application Support/HostsManager/config.json:
{
"enabled": true,
"profiles": [
{
"id": "11C3369A-194C-4D63-BADD-E5A3D2714295",
"name": "Office",
"matchKind": "wifiSSID",
"matchValue": "Office WiFi",
"entries": "10.0.0.20 git.internal\n10.0.0.21 docs.internal"
}
]
}matchKind accepts wifiSSID, routerIP, or routerMAC. Profiles are evaluated in list order and the first match wins.
- Open
HostsManagerForMacOS/HostsManagerForMacOS.xcodeprojin Xcode. - Select the HostsManagerForMacOS scheme and My Mac as the destination.
- Choose Product → Archive.
- In the Organizer, select the new archive and click Distribute App.
- Select Custom, click Next, select Copy App, and export it.
- Drag
HostsManager.appinto/Applications. - Launch the app from Applications, configure at least one network profile, and click Install / Repair.
- Approve the administrator prompt. This installs and starts the system LaunchDaemon used to update
/etc/hosts.
Copy App is appropriate for installing a local build on your own Mac. For distribution to other users outside the Mac App Store, choose Direct Distribution and complete Developer ID signing and notarization instead.
After installation, the GUI can be closed. The daemon continues running and starts automatically at system boot. Use Enabled to suspend hosts management without uninstalling it, or Remove Service to unload and delete the background service.
When replacing the app with a newer build, launch the updated copy from /Applications and click Install / Repair again so the installed daemon is updated as well.
Open HostsManagerForMacOS/HostsManagerForMacOS.xcodeproj in Xcode. The app build embeds the daemon automatically.
xcodebuild -project HostsManagerForMacOS/HostsManagerForMacOS.xcodeproj \
-scheme HostsManagerForMacOS -destination 'platform=macOS' \
-only-testing:HostsManagerForMacOSTests testLicensed under the MIT License. Copyright © 2026 Glenn R. Martin.
