⚠️ DEPRECATED
This crate has been renamed to hostie.
Please use hostie instead of locdev.
hostie 🛠️
hostie is a handy CLI tool that simplifies the process of adding, removing, and
listing entries in your system's hosts file (/etc/hosts on Unix, C:\Windows\System32\drivers\etc\hosts on Windows).
Perfect for developers who need to quickly map hostnames to IP addresses for local development, testing, or debugging. You no longer need to deal with manual and error-prone editing. Now, it's as simple as running a command.
Why use hostie?
Instead of manually editing your hosts file like this:
# Navigate to the right line, be careful not to break anything...
# Add: 127.0.0.1 myapp.local
# Save and exit
Just do this:
Features
- 🚀 Simple commands: Add, remove, and list hosts entries with ease
- 🛡️ Safe operations: Prevents accidental removal of system entries like
localhost - 🎯 Precise matching: Only exact IP+hostname combinations are affected
- 🌍 Cross-platform: Works on macOS, Linux, and Windows
- 📝 Preserves formatting: Keeps your hosts file comments and structure intact
- ✅ Duplicate prevention: Won't add the same hostname twice
- 🧪 Well-tested: 24 comprehensive tests ensure reliability
Installation
Download Compiled Binaries
You can download the compiled binaries for hostie from the
GitHub Releases page. Choose the
binary that corresponds to your operating system and architecture, and place it
in a directory included in your system's PATH environment variable.
Install with Cargo
To install hostie using Cargo, you'll need to have Rust installed on your system. Once Rust is installed, you can install hostie with Cargo:
Usage
Commands
add <ip> <hostname>: Add an entry to the hosts file with the specified IP and hostnameremove <ip> <hostname>: Remove the entry with the specified IP and hostname from the hosts filelist: Print the current entries in the hosts file
Examples
Basic Usage
Add a local development site:
Remove an entry when you're done:
List all current entries:
Common Development Scenarios
Set up multiple local services:
Point to a staging server:
Override a production domain for testing:
Block a website (point to localhost):
Sample Output
What hostie does for you
- ✅ Prevents duplicates: Won't add the same hostname twice
- ✅ Protects system entries: Can't accidentally remove
localhost - ✅ Preserves formatting: Keeps comments and empty lines intact
- ✅ Cross-platform: Works on macOS, Linux, and Windows
- ✅ Safe operations: Only modifies exact matches, no false positives
Note
You need to use sudo to execute the add and remove commands, as the hosts
file requires administrator privileges to modify its contents.
License
This project is available under the MIT License.