DNS servers map domain names to specific server IP addresses so people can access your website through domain name without knowing your server IP address. Compared to numeric IP addresses, domain names are much easier to remember and they can help to build your brand. When you migrate your site to a new server, the DNS servers or DNS records need to be updated to point your domain to the new DNS server or IP address. In earlier articles, we have demonstrated how you can change DNS servers with GoDaddy, or change DNS A records with DoDaddy.
As a web master, you may want to test your site on the new server before redirecting all site visitors to the new server. In such case, you can simply emulate DNS change on PC in the Hosts file. The hosts file is a local configuration file on our computers. It provides us a handy way to override those public DNS servers. We can manually edit this file to easily point a website address to a desired IP address. From previous linked guide, you’ll learn how to edit the hosts file on a Windows computer. Today, we will show you how to achieve it on a Mac.
Finding hosts file on Mac
Launch Finder, click Go > Go to Folder, copy and paste /private/etc/hosts to the box and click Go button to find the hosts file in Finder.
Editing hosts file on Mac
Before you make any change to the hosts file, duplicate it first. You will be prompted to enter the password for your admin account in order to duplicate this file in the etc folder.
You can’t directly edit the hosts file in the etc folder on Mac. Instead you need to copy and paste it to your desktop or any other folder, and then edit it. Right click on the hosts file in the new folder or location, choose to edit it with the TextEdit app or any other third-party text editor on Mac. After the change, copy and paste it back to the etc folder in Finder. Choose “Replace” when the Mac OS asks you what to do with the original hosts file. And then enter your administrative account password to authenticate the replace.