How to Edit the Hosts File on Your Mac

Editing the hosts file on your Mac allows you to test your site before it goes live. Launch Terminal, copy and paste the following command:

sudo nano /etc/hosts

Add the IP address (example: of the site’s server follow by the domain name:

Save the file by pressing Ctrl+O then exit with Ctrl+X.