What happens if I remove the localhost address from /etc/hosts

dnshosts

I have looked at the hosts file before but never thought of this. The hosts file overrides the DNS addresses so it can be used to forward sites or to block them.

When looking at the file, the default says this.

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

What happens if remove or change the localhost configuration file? Would it prevent my Mac from booting. Would I be able to boot into recovery mode and revert the changes or would I have to reinstall the OS? If I had bootcamp would I be able to fix it by booting into Windows?

Best Answer

the only difference is that in order to access local web servers (for development purposes) you will need to use the address 127.0.0.1 instead of localhost.