mac-hosts-manager is a modern macOS utility for managing your system's /etc/hosts file with a user-friendly interface. Built with React, Vite, and Electron, it streamlines editing, organizing, and applying host entries. The app is designed for macOS and includes potential integration with TouchID for secure, persistent sudo access.
- Modern UI: Fast, responsive interface built with React and Vite.
- Hosts File Management: Easily view, edit, add, remove, and reorder entries in your
/etc/hostsfile. - Drag-and-Drop Support: Reorder host entries intuitively (powered by dnd-kit).
- macOS Native Integration: Electron-based desktop app tailored for macOS.
- TouchID Sudo Integration: Optionally leverage TouchID for secure sudo operations (see below).
- Cross-Platform Packaging: Scripts for building and packaging the app for macOS, Windows, and Linux.
-
Clone the repository:
git clone https://github.com/yourusername/mac-hosts-manager.git cd mac-hosts-manager -
Install dependencies:
npm install # or yarn install -
Start the application:
npm start # or yarn startThis will launch both the Vite development server and the Electron app.
-
Build for production:
npm run build npm run build-electron
-
Package the app (macOS example):
npm run package:mac
See
package.jsonfor more packaging options.
- Launch the app using
npm startoryarn start. - The main window displays your current
/etc/hostsentries. - Add, edit, or remove entries as needed.
- Drag and drop entries to reorder them.
- Save changes to update your system's hosts file (admin privileges required).
- If TouchID integration is enabled, you can authenticate sudo operations with your fingerprint.
To enable persistent TouchID authentication for sudo operations (recommended for seamless experience):
-
Copy the template to create a local sudo PAM config:
sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
-
Edit
/etc/pam.d/sudo_localand uncomment the following line:auth sufficient pam_tid.so
This configuration allows TouchID to be used for sudo and persists across system updates.