The host file on a Mac, located at /etc/hosts, allows users to manually map domain names to IP addresses, overriding the default DNS resolution. This can be useful for testing website changes, blocking specific websites, or resolving domain names to local development servers.
Accessing and Editing the Hosts File:
- 1. Open Terminal: Locate and open the Terminal application (found in Utilities within Applications, or by searching with Spotlight).Â
2. Open the Hosts File:
Use the command sudo nano /etc/hosts to open the hosts file with administrative privileges using the nano text editor.
3. Enter Password:
You’ll be prompted to enter your Mac’s administrator password. Note that the cursor will not move while typing the password, this is normal.
4. Edit the File:
- Add new entries in the format:
IP_address domain_name(e.g.,192.168.1.100 www.example.com).Â
Use the arrow keys to navigate and make changes. Comments can be added by starting a line with #.
5. Save Changes:
Press Ctrl + X, then Y to confirm saving, and finally Enter.
6. Flush DNS Cache:
To apply the changes, flush the DNS cache using the command sudo killall -HUP mDNSResponder.
https://www.hostinger.com/tutorials/how-to-edit-hosts-file-macos%23:~:text%3DWhat%2520Is%2520the%2520Hosts%2520File,it%2520to%2520a%2520hosting%2520plan.
More Stories
Protected: denningtradelaw.com
Censorship by Host Providers