Step 1 – Open application

You can open the application writing terminal on the spotlight, or simply go to application » Terminal.


Step 2 – Open Hosts File

Open hosts file writing on Terminal:

$ sudo nano /private/etc/hosts



Step 3 – Edition

The edit or add something to hosts file you can simply add a line like this: yourdomain.comnetorg



Step 4 – Save Changes

When you have finished your changes, press control + o and Enter to save.
Then control + x to exit Nano Editor.


Step 5 – Clean DNS cache

You can clean you DNS cache with your terminal running this simple command:

$ dscacheutil -flushcache

Now you can test your change on the hosts file.