How to quickly edit your hosts file on macOS

screencast Jan 17, 2017

I had a friend ask me the other day how to edit his hosts file for local development. It's something I take for granted because I'm so used to doing it, but for him it was something he hadn't done before. # Use arrow keys to move to what you want. I decided I'd throw together a quick 60 second video on how to do it...

Here are the commands I used...

sudo vim /etc/hosts

Then use i for entering edit mode, move your cursor to where you want to edit. Enter the IP address and the hostname.

Then it's escape to exit insert mode, wq to save and quit.