If you can not edit your hosts file located in “private/etc” directory, it’s because;

The whole directory has “admin” permissions, and your text editor maybe running with your current user permissions. You can either move the Hosts file to desktop and edit it, and put it back, or use Terminal and edit the file.

Open Terminal.

Type cd /etc

Type sudo nano hosts

Type your password

Edit File

Hit Ctrl + O to save

Hit Ctrl + X to quit