How To Modify Hosts File On Mac

How To Modify Hosts File On Mac

Every website has a unique numeric IP address, which makes your browser find the website you are looking for. Every time you type a URL in your browser, it will be translated into the IP address format, making the browser display the right page you are looking for. Host files on your Mac are important text documents that let you map hostnames to a specific IP address.

Modifying the hosts file on your Mac is not a cumbersome process. You only want to know the server’s IP address and domain name. Now, let’s learn How To Modify Hosts File On Mac Computer.

How To Modify The Hosts File On Your Mac?

Modifying the hosts file on Mac is not a difficult task at all. The following instructions will show the whole procedure in detail.

  • To begin with, launch the Terminal window on your Mac (Applications> Utilities> Terminal).
  • Type sudo nano /etc/hosts and press Return.
  • When the system prompts you to input your administrator password, type it and press the Enter key.
  • Now, you will be in the Nano text editor. Here, you can edit the Mac’s hosts file just as you prefer.
  • To create space below the existing records, use the Return key.
  • Input your IP address and press the tab key.
  • Enter the domain name you want and save the file by pressing the Ctrl and O keys.
  • Ensure that the IP address comes first and the server name goes next. Consider this example – “”
  • If you make a mistake while typing the details, press the # key at the beginning of that line; this will tell your Mac to ignore the line.
  • To clear your Mac’s DNS cache and avoid clashes between DNS and hosts file, type the following command: sudo killall -HUP mDNSResponder.
  • The changes you have made will reflect immediately.
  • When you use the Mac hosts file like this, you can input any IP address you need. You can also use this procedure to block malicious websites.

This way, now you How To Modify Hosts File On Mac Computer. Do you have any other questions or need clarifications? Reach our technical experts for real-time assistance using the call option.

Contact Us