Mac OS

How to locate and edit the host file on macOS

locate host file

In macOS, accessing the hosts file is via the terminal. You can use your desired editor. I will be using the iTerm terminal as shown below.

Enter the command below “sudo vim /etc/hosts
– Here I am using VIM which is a Text Editor in Unix Systems

edit host file

How to locate and edit the host file on macOS

You will be prompted to enter your password as shown above and when the right credential is entered, the host database will be opened as seen below.

macOS host file

To manipulate this file, use the “I” button on your keyboard in order to modify this field. This will let you enter a new host entry.

When you are done, you can hit the “Esc” button on your keyboard
– Following by a semicolon “:”
– For by “w” to save and
– Followed by “q” to quit as shown below

That is all you need to know on How to locate and edit the host file on macOS.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x