If you need to add or edit an entry to your Mac host file then open your terminal/console enter the following command:

sudo vim /private/etc/hosts

After editing your host file you should clear your host cache. Enter the following command to clear your cache:

dscacheutil -flushcache