How to edit Hosts File on Mac when it’s locked/disabled

If you tried to edit Hosts file from Finder and encountered this problem/ error:

You don’t own the file “hosts” and don’t have permission to write to it.

then you should change the content of Hosts via Terminal, which will work fine.

Changing Hosts file in Terminal- Instructions

  1. go to Terminal
  2. Enter this: sudo nano /private/etc/hosts
  3. You might need to enter the password that you use for your Mac account
  4. Edit Hosts file, first part of the line is the IP and the second part is  domain, for example:
    1.       178.218.174.68  website.com www.website.com
  5. To Save click control+ O and hit enter
  6. That’s it, your Hosts file is successfully edited.

 

Feedback from Facebook

Leave a Reply

Your email address will not be published.