Editing your hosts file in Mac OS X

So you need to edit your hosts file?

It’s path is /etc/hosts but being a system file, you’ll need to use sudo to get to it.

Open a terminal and type:

sudo vim /etc/hosts

Now, you’re using the vim text editor.  Press i to go into insert mode.  You will know you are in insert mode because of the — INSERT — at the bottom of the window.

Make your changes and hit ESC to exit insert mode.

:w[enter] will write the changes to file.
:wq[enter] will write the changes to file and quit.
:q[enter] will quit if no changes have been made.
:q![enter] will quit and ignore changes that have been made.

Job done

You May Also Like

About the Author: John

Leave a Reply

Your email address will not be published. Required fields are marked *