Search Our Database
How To Edit The “hosts” File on Mac Os
Step 1 – Go to Utilities and select on Terminal.
Step 2 – Login as root by running the command as below then enter the password.
User-MacBook:~ user$ sudo su -
Password:
After that you will see that the user become root as below:-
User-MacBook:~ root#
Step 3 – Open the hosts file by using the command as below and edit the hosts file by press “i“.
User-MacBook:~ root# vi /etc/hosts
##
# 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
fe80::1%lo0 localhost
Step 4 – Add the IP address and the domain name like the example below and press “Esc” then save it by using “:wq!”
##
# 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
fe80::1%lo0 localhost
123.123.213.123 www.example.com example.com
Step 5 – Open the browser and go to the domain you like to preview.