Singapore & Australia # 1 for Web Hosting & Domains
SG: +65 6914-7888   AU: 1300-863-436 Asset 1colo Help
Vodien Logo
  1. Home
  2. Knowledge Base
  3. Useful Tips
  4. How To Add and Edit Host File Entry for Mac PC

How To Add and Edit Host File Entry for Mac PC

A host file entry consists of a domain name and an IP address of the hosting server. When you access the domain name, your browser will redirect you to that hosting server which could be different from the actual live website. This is necessary if you test a staging site, given that it is hosted on a different server.  

Add a host file entry if there is none for your domain name or website. Follow the steps below to add the entry. Edit a host file entry if you want to change the IP address for the same domain name or website. You need to do the same thing to disable it so that you can access the actual live website.   

  1. Open Finder 
  2. Select Go.
  3. Click Utilities. 

Mac PC Utilities Tab

4. Open the Terminal application. 

Mac PC Terminal App

5. Type sudo nano /etc/hosts and press Return. 

6. Enter your admin password (your password to log in to your device). 

7. Use the Return key to create some space below the existing records 

8. Enter the TCP/IP address. 

9. Press the Tab key. 

10. Type in the domain name. 

11. Save the file by pressing Ctrl + O. 

12. Close the window by pressing the keys Ctrl + X. 

13. Type sudo killall -HUP mDNSResponder followed by Return to clear your device’s DNS cache. 

(Visited 20 times, 1 visits today)
Updated on January 31, 2023

Was this article helpful?

Related Articles