How to Edit the Hosts File (Mac)


How to edit the hosts file in Mac OS X Leopard, Snow Leopard and Lion.


A hosts file is a plain-text file used by your Mac or Windows computer to map hostnames (such as Autodiscover) to IP addresses and is useful when you are unable to modify or access your DNS control panel.


Important Note: The above steps are advanced and we recommend that only your local IT admin proceed with them. Please note that Sherweb will not support issues related to the creation of a host record. We provide the following how-to for your convenience only.

How to

Note: This change is only valid for the machine in which the .hosts file has been edited.  If you have additional machines such at home or maybe a laptop, then you will need to repeat this process each time.


1) Open the hosts file.


1. Open Terminal via Spotlight or by pressing (command) + Spacebar. Now type terminal




2. Terminal should now open and should look like the following:  




3. Now Type or copy and paste the following code into terminal window and press the Enter key:  sudo nano /private/etc/hosts.


4. You may get asked for a password.  If you do, enter the one you use to login to your Mac.


2) Edit and save the hosts file.


1. You should now see a terminal window called Nano that will allow you to edit your file.  To start editing use your arrow keys to place your cursor at the very end of the last line.  




2. Now type the lines like the following example below but replace ( with your primary email address that you will use with Sherweb.  




3. Press the Enter key and then press (command) + the key. Then key to save the changes and Enter to accept the default file. 




3) Undo the hosts file change.


1. Open the hosts file as described above.


2. Delete the information that you added previously, then close and save the file.