How to edit Hosts file [OSx 10.10]

What is a hosts file?
The hosts file on your Mac and PC are a local file that is used to map host named to IP’s. Every time you visit a website your computer looks at the hosts file for reference and if it doesn’t find any references to it then it looks for it using an online DNS server.


  1. Open the Terminal application.
    Terminal Mac OSX 10.10
  2. Type in, and hit return:
  3. It will ask you for a password. Type it in and hit return.
  4. Once the hosts file is open, you can modify it to your needs and click Control+X to exit. It will ask you to save. Y for yes and N for no.
  5. If you made changes to it make sure to open up Terminal again and flush the DNS cache for it to take effect. You might need to restart your Mac. You flush the DNS by typing in this command on the Terminal:


On This example I will add and point it to the localhost IP (
editing hosts file

You can use the Hosts file to block websites on your computer. If you point them to the localhost IP ( it will most likely load nothing. In this case, if I visited, the website would not load.


You may also like...

Leave a Reply

%d bloggers like this: