Ho

Hostflip – a macOS /etc/hosts switcher that detects external edits

Hacker News

Hostflip – a macOS /etc/hosts switcher that detects external edits

Hi HN — I built hostflip, a native macOS menu bar app for switching /etc/hosts profiles. It is free and open source under the MIT license. The problem I wanted to solve was not just editing hosts entries. It was sharing /etc/hosts with Docker Desktop, VPN clients, scripts, and manual edits without one writer silently erasing another's changes. On first run, hostflip captures a read-only baseline (called Base Hosts) from the existing file and keeps the untouched original as hosts.orig. Active profiles are appended after the baseline in a clearly marked block. Writes are still atomic whole-file replacements under the hood. Before each write, the daemon hashes the live file and compares it with the expected hash. If they differ, it refuses the write; the app shows a diff and asks the user to reconcile the change first. A few other details: - Profiles can live in groups. At most one profile per group is active, while active profiles from different groups and standalone profiles stack together. - After a one-time approval in System Settings, subsequent switches no longer prompt for a password. The root helper is registered through SMAppService and exposes a single XPC operation: atomically replace the hosts file with merged content. The app and daemon verify each other's signing identity. - The bundled CLI shares the same workspace as the app and supports structured JSON output. hostflip doctor dev.example.com traces a hostname from profiles through the merged output and the live /etc/hosts file to the system resolver. - Remote profiles can refresh from HTTPS sources on a schedule. There is also an importer for existing SwitchHosts configurations. - The editor has cross-profile hostname/IP search, comment toggling, basic validation for malformed hosts lines, and stays responsive with large remote profiles. The app is built with Swift and SwiftUI, distributed through Homebrew or a signed and notarized DMG, and currently requires macOS 14 or later on Apple silicon. Intel, Windows, and Linux are not supported. I would especially like feedback on the conservative drift behavior: if another process changes /etc/hosts, hostflip blocks further writes to the system file until the user reviews the diff. How do you handle multiple writers to the hosts file, and would you expect a different reconciliation model?

Share card

Actual performance

3points
1comments
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: mac, macos, model · Missing: agents, agent, cursor
93%93% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Strong signals: supports, vpn · Missing: reddit linkedin, podcasting, created
90%90% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: exist, open source, existing · Missing: https docs, excited, just released
38%38% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Strong signals: apps · Missing: mobile apps, ios, personal
35%35% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: reviews, host · Missing: plus, platform, intuitive
32%32% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: active · Missing: arr, mrr, revenue
20%20% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

GroupTab
GroupTab75%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Grouped App Switcher for macOS

Product Hunt+125Mac
I
I built a grouped app switcher for macOS55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

I built a grouped app switcher for macOS

Hacker News2
A
A space switcher for macOS, combining Phoenix and Alfred53%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A space switcher for macOS, combining Phoenix and Alfred

Hacker News1
Ro
Robata, macOS window switcher43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Robata, macOS window switcher

Hacker News2
Vi
Vim-snipe – Targeted linewise motions and edits62%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Vim-snipe – Targeted linewise motions and edits

Hacker News4
A
A rofi like switcher for macOS written in Hammerspoon61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A rofi like switcher for macOS written in Hammerspoon

Hacker News2
I3
I3wm Workspace Switcher43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

I3wm Workspace Switcher

Hacker News1
Th
The shortcuts and workspace switcher macOS deserves (using Phoenix)45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

The shortcuts and workspace switcher macOS deserves (using Phoenix)

Hacker News1
I
I built a keyboard-first window switcher for macOS50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

I built a keyboard-first window switcher for macOS

Hacker News2
Di
Direnvp – Direnv Profile Switcher37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Direnvp – Direnv Profile Switcher

Hacker News8