How To Edit Host File On Mac OS X

How To Edit Host File On Mac OS X

Mac is world popular Operating system and due to its effectiveness, enriched reliability and advanced security Mac OS X has been consider the best operating system. Sometimes it happens that you need to set up a new web server or want to connect new device to Internet or having any problem with spyware or adware network then in such case an invisible file that’s on your Mac can help you greatly. That very file is known as ‘Host File’. Although Mac’s hosts file is small, but very important text document that has ability to map host names to the specified IP addresses.

When we type in the domain name of any web site that we want to visit there a lot happens behind the scenes. As every web site, every service, and almost every device that is connected to the Internet has unique numeric address that notifies all other devices where it is — its TCP/IP address. The Domain Name System abbreviated as DNS translates those very numeric addresses into something that bit more recognizable as well as memorable to humans. So, when you type in a web address the very first time Mac system pings DNS server — typically one automatically that configured for you via your Internet Service Provider just in order to find out the very TCP/IP address of server you’re trying to connect. Mac OS X builds up a hidden cache file just to remember those details when you visit the same site again.


What is the Host File

Mac’s standard way of knowing how to get to where it’s going on the Internet, is the Domain Name System and its very associated cache. However, there’s an another file that also proves very useful. It’s known as the Hosts file, and it used to override the default DNS information.

However, query arises why want to use the Hosts file instead of just letting DNS? Actually, Hosts file is used to block or work around some spyware or ad networks by just “zeroing out” their IP addresses – putting alike then after the name of the domain you’d like to block.

So, you have seen how it’s easy to do so. But at times that might Mac system not perform well and you need to format the drive. I have seen alike situation. But you don’t need to be disappointed as there is way to get your data back.

For more Info:-

How To Edit Host File On Mac OS X

Although, it sound complex but it’s very easy to do so. Here we will guide you how to edit host file on Mac OS X?

The best way to work with the very Hosts file on Mac is using Terminal application that found in your Mac’s Utilities folder. But before, you’ll need to know the IP address of the very device that you’d like to send your Mac to, or the very domain names that you’re trying to keep your Mac system away from.

Step 1:- Double-click Terminal to Open the Application.

Double-click Terminal.

Step 2:- Type sudo nano /etc/hosts >> Hit return.


Step 3:- When you would be asked for your password. Enter your admin password.

Step 4:- Now you’re in Nano text editor.


If you want to add a new device or domain, move cursor using the cursor keys and just position it after the text that you see, then after begin typing. In case if you’re mapping particular IP address onto your local network to domain, then you need to perform:-

Type the IP address>> Hit tab>>Then type the domain name.

Once you have completed the step, hold down the control and O keys in order to save the file and then press control and X to exit. Now, back to command line,

Type sudo killall -HUP mDNSResponder then type return.

It will flush your Mac’s DNS cache, so that it doesn’t get confused by any changes that you’ve made to the very Hosts file.


How To Edit Host File On Mac OS X

Leave a Reply

Your email address will not be published. Required fields are marked *