One of the things you can do with the hosts file is to set up redirects. You can modify these in any way you want to achieve desired results.
In a nutshell, the hosts file is nothing but a combination of IP addresses and domain names. When you enter localhost in your browser, your browser looks into the hosts file, obtains the specified IP address, and takes you to that IP address. The above two parts, when combined together, redirect all the localhost queries to the IP address 127.0.0.1. The second section where it has the host name is what you use to access that IP address. Restart your Mac and the Hosts file changes should come into effect.The first section with numbers is the local IP address for your Mac.
#UPDATE MAC HOST FILE PASSWORD#
Type in the password (note that when filling in the password no characters would show be displayed, but this doesn ’ t mean you aren ’ t typing anything). This will open the Hosts file but you will first need to provide your Administrator password. After you back up the Hosts file, type the sudo nano /private/etc/hosts command in Terminal.If you want to restore the original Hosts file from the backup, type the sudo cp ~/Documents/hosts-backup /private/etc/hosts command in Terminal. This command backs up the Hosts file in case you need to recover it. Next, type the following command in Terminal: sudo cp /private/etc/hosts ~/Documents/hosts-backup and press Enter to execute it.From the keyboard, press Command and Space and then type in Terminal.Choose the replace option and provide your Administrator password if asked to. The system will require you to confirm the action and then ask you if you want to replace the original Hosts file with the new one.
#UPDATE MAC HOST FILE SOFTWARE#
Now, open the copied Hosts file (any text-editing software should be able to open it).To override the protection, simply copy the Hosts file to another unprotected location (such as your Desktop).In the folder that opens, you will see the Hosts file but won ’ t be able to modify it because the Etc folder is protected against modification by default.Select Go or hit Enter to initiate the search.Next, select the Go to Folder option and type in this file path: /private/etc/hosts.
Here, we will show you two ways you can find, access, and edit the Hosts File on your Mac.
Modifying the Hosts file can allow you to troubleshoot certain connection issues, block certain sites, set up your own web-server, and more. The Hosts file is a small file that every Mac computer has, in which are stored the hostnames of different IP addresses.