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

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