How to Edit your Hosts File on a Mac

Your computer uses the HOSTS file to look up/resolve domain names to an IP address. This file can force your computer to resolve your website to a specific IP address rather than using the DNS entries indicated by the domain’s name servers.

Manually configuring your domain with the IP address of your server will allow you to point a domain name to a different server location using an IP address. A HOSTS file change is intended to be temporary and should not be used with the published website.

You can use a terminal client application, or the one Apple provides in its operating system when editing your HOSTS file.

  1. Open the Terminal client of your choice.


  2. Edit the HOSTS file in the terminal window using one of the commands below.

    sudo nano /private/etc/hosts

    For newer versions of Mac OS, use this command:

    sudo nano /etc/hosts


  3. Enter your Apple login password for your device.


  4. Edit the HOSTS file by adding these two lines.

    SERVER_IP_ADDRESS domain.com
    SERVER_IP_ADDRESS www.domain.com

    This is an example of how it would appear in the HOSTS file:

    86.75.30.9 domain.com
    86.75.30.9 www.domain.com

    NOTE: Replace “domain.com” with your actual domain name. If you are unsure which IP address to use, please contact support for further assistance.

  5. Save your changes by pressing Control-O on your keyboard, then hit the enter key to accept the filename.


  6. Exit the editor by pressing Control-X.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Banned WordPress Plugins

This article lists plugins not allowed in our environment and why they cannot coexist with our...