How to edit your host file on a Mac

Apple's Terminal App Icon

Changing the contents of a computer’s host file is extremely helpful skill for web developers to have. You can basically manipulate the way your computer looks at the internet. I use it to keep Google Analytics from counting me as a visitor on my site (or any site for that matter). Whatever your reasons for editing your host file, here’s how to do it on a Mac.

1. Open Terminal

2. Type: sudo pico /etc/hosts

3. Type: YourPassword
*This is the same password you use to log in to your computer

4. Edit host file

5. To save your changes hold down CONTROL & press the letter ‘O’. Then press ENTER

6. To exit your host file hold down CONTROL & press the letter ‘X’.

7. To quit Terminal simply hold down COMMAND & press the letter ‘Q’ at the same time.

And that’s it. You’ve just edited your Mac’s host file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at

Up ↑

%d bloggers like this: